Android SparseArray edit

How to use SparseArray


A SparseArray is an alternative for a Map. A Map requires its keys to be objects. The phenomenon of autoboxing occurs when we want to use a primitive int value as key. The compiler automatically converts primitive values to their boxed types (e.g. int to Integer). The difference in memory footprint is noticeable: int uses 4 bytes, Integer uses 16 bytes. A SparseArray uses int as key value.


Advantage :

Disadvantage :

There are several variants of the family like : -SparseArray <Integer, Object> -SparseBooleanArray <Integer, Boolean> -SparseIntArray <Integer, Integer> -SparseLongArray <Integer, Long> -LongSparseArray <Long, Object> -LongSparseLongArray <Long, Long>

SparseArray operations

Feedback about page:

Optional: your email if you want me to get back to you:

Table Of Contents
64 Menu
112 Loader
119 Xposed
132 Colors
135 Fresco
140 AdMob
147 Button
156 Vk SDK
170 XMPP
176 OpenCV
200 FileIO
203 Moshi
207 SparseArray
217 Paint
231 AIDL
241 JCodec
243 Okio
255 Looper
  ↑ ↓ to navigate     ↵ to select     Esc to close