Category : hashmap

This question is about custom annotation in Android development (Java/Kotlin). I want to create custom annotation for methods and their parameters, then create a HashMap from annotation keys and parameter values. My app is currently using ParseCloud as network library. A typical ParseCloud API request looks like: ParseCloud.callFunctionInBackground(String, Map<String, Object>, FunctionCallback<T>) For example, if I ..

Read more

In Android, Parcelable is supposed to be much faster than Serializable. However HashMap is not a Parcelable, we can still make it Parcelable if our key/value are primitive types or Parcelable, like this: class MyParcelableMap() : HashMap<Int, String>(), Parcelable { constructor(parcel: Parcel) : this() { val keys = parcel.createIntArray() ?: IntArray(0) val values = parcel.createStringArray() ..

Read more

Actually, I’m working on android File transfer over Bluetooth and want to transmit large videos file with their DB object model so I’m putting these two data into hashmap after converting them to byte[] indu=ividually, after this, I convert hashmap into byte array and send to the receiver. At the receiving end, I’m reversing all ..

Read more

The implementation of ConcurrentHashMap is quite complex, as it is specifically designed to allow concurrent readability while minimizing update contention. At a very high level of abstraction, it is organized as a bucketed hash table. One problem with ConcurrentHashMaps, in the context of mobile apps, are functions such as compute() and computeIfPresent() which require API ..

Read more