[Map] HashMap vs. TreeMap vs. LinkedHashMap [Map] HashMap vs. TreeMap vs. LinkedHashMap -HashMap Key 는 equals 와 hashCode 가 구현되어 있어야 한다. O(1) time complexity -TreeMap ( SortedMap ) Key 가 Red-black tree structure 를 사용하여 ordering 되어 있는 형태의 Map Key 가 Comparable 을 구현해야 한다. 그래야 tree 에서 비교를 할테니... ( 참고로 String 은 Comparable 하다 ) Key 가 정렬되어 있다는 의미는 keys() 나 entrySet() 을 가지고 왔을 때, Comparable.compare 에 의한 정렬결과 순으로 collection 이 구성된다는 것이다. Tree 를 사용했다.. 2019. 1. 11. [android] ArrayMap 과 SparseArray 를 이용한 최적화 [android] ArrayMap 과 SparseArray 를 이용한 최적화 https://medium.freecodecamp.com/android-app-optimization-using-arraymap-and-sparsearray-f2b4e2e3dc47#.pg0eea2cx ArrayMap vs. HashMap -ArrayMap 은 android.util.ArrayMap 과 android.support.v4.util.ArrayMap 두 가지 형태가 있다.뒤의 녀석은 compat 이슈를 위한 것. -ArrayMap 은 HashMap 보다 더 memory 최적화된 데이터 구조를 가진다.ArrayMap 은 array 를 이용해 mapping 을 관리한다.Hash integer 를 가지고 있는 array 와,.. 2018. 3. 5. 반응형 이전 1 다음