Following are the best practices related to collection framework.
• Use ArrayLists, HashMap when required to avoid thread synchronization overhead. Also you can use arrays when possible. You can achieve thread synchronization by:
• Specify the initial values for ArrayList and HashMap because these grow periodically to get space for
Java Code: This is an example of list and map
Map myMap = Collections.synchronizedMap(myMap);
List myList = Collections.synchronizedList(myList);