Tagged: #hashmap

Hashtable VS HashMap

Hashing objects like HashMap and Hashtable are mostly used for storing and caching data as a key/value pairs inside the memory. In this tutorial, we list the major similarities and differences between these 2 data types. 1- Similarities Both expose the same interface for adding, removing and accessing elements from the memory. get(): retrieve an item by a key. remove():...

Convert JSON to Java Object

This tutorials shows 2 ways for converting a JSON string to a Java object. 1- Gson Gson is the most popular library for converting JSON string to Java objects. With Gson, you can do the conversion in one line as the following:

Some points to be considered when using Gson: If the JSON string holds an invalid object attribute, then Gson implicitly...