Android性能优化之使用SparseArray代替HashMap

来源:互联网 发布:淘宝打印快递单步骤 编辑:程序博客网 时间:2024/06/02 02:13
HashMap<Integer, E> hashMap = new HashMap<Integer, E>();


可以用

如下的方式来取得更好的性能
SparseArray<E> sparseArray = new SparseArray<E>();


HashMap<Integer, boolean> hashMap = new HashMap<Integer, boolean>();可以用
SparseBooleanArray hashMap  = new SparseBooleanArray(); 代替






0 0
原创粉丝点击