Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

16. Collections and Generics: Data struc... > ArrayList is not the only collection

ArrayList is not the only collection

image with no caption

Although ArrayList is the one you’ll use most often, there are others for special occasions. Some of the key collection classes include:

Note

Don’t worry about trying to learn these other ones right now. We’ll go into more details a little later.

  • TreeSet

    Keeps the elements sorted and prevents duplicates.

  • HashMap

    Lets you store and access elements as name/value pairs.

  • LinkedList

    Makes it easy to create structures like stacks or queues.

  • HashSet

    Prevents duplicates in the collection, and given an element, can find that element in the collection quickly.

  • LinkedHashMap

    Like a regular HashMap, except it can remember the order in which elements (name/value pairs) were inserted, or it can be configured to remember the order in which elements were last accessed.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial