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():...
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:
public static Student convertUsingGson(String jsonStr)
Gson gson = new Gson();
Student student = gson.fromJson(jsonStr, Student.class);
Some points to be considered when using Gson: If the JSON string holds an invalid object attribute, then Gson implicitly...