Browse - Programming Tips - What Java collections do you prefer?

Date: 2013aug30
Updated: 2016jun23
Language: Java

Q.  What Java collections do you prefer?

A.  There are many collections classes but it pays to use a limited
number.  One good reason: so you can pass results from one function to another.

java.util.ArrayList - growable array java.util.HashMap - hash (associative array) java.util.Hashtable - when you need a synchronized hash (associative array) java.util.Stack - stack java.util.HashSet - set (check if something is a member) java.util.concurrent.LinkedBlockingQueue - queue for communication between threads java.util.TreeSet - case insensitive set java.util.TreeMap - case insensitive hash