Dave's Brain

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

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.