Skip to Content
Ivor Horton's Beginning Java®, Java 7 Edition
book

Ivor Horton's Beginning Java®, Java 7 Edition

by Ivor Horton
September 2011
Beginner
1152 pages
41h 59m
English
Wrox
Content preview from Ivor Horton's Beginning Java®, Java 7 Edition

Chapter 14

The Collections Framework

WHAT YOU WILL LEARN IN THIS CHAPTER

  • What sets, sequences, and maps are, and how they work
  • The capabilities of the EnumSet<E> collection class
  • What a Vector<T> collection object is and how to use Vector<T> objects in your programs
  • How to manage Vector<T> objects so that storing and retrieving elements is typesafe
  • What a Stack<T> collection is and how you use it
  • How you use the LinkedList<T> collections
  • How you store and retrieve objects in a hash table represented by a HashMap<K,V> object
  • How you can generate hashcodes for your own class objects

In this chapter you look at the Java collections framework, which consists of generic types that represent sets of collection classes. These types are defined in the java.util package, and they provide you with a variety of ways for structuring and managing collections of objects in your programs. In particular, the collection types enable you to deal with situations where you don’t know in advance how many objects you need to store, or where you need a bit more flexibility in the way in which you access an object other than by the indexing mechanism provided by an array.

UNDERSTANDING THE COLLECTIONS FRAMEWORK

The Java collections framework is a set of generic types that you use to create collection classes that support various ways for you to store and manage objects of any kind in memory. Recall from Chapter 13 that a collection class is simply a class that organizes a set of objects of a given ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

Mastering Java 11 - Second Edition

Mastering Java 11 - Second Edition

Dr. Edward Lavieri Jr., Mandar Jog

Publisher Resources

ISBN: 9781118173411Purchase bookDownloads