Java Reference
In-Depth Information
Chapter 11
Java Collections
Framework
Introduction
11.1 Lists
Collections
The previous chapter explored the ArrayList class. An ArrayList is
one of many ways to store data in Java. In this chapter we'll explore Java's
framework of collections, including lists, sets, and maps.We'll see how to
use these structures together to manipulate and examine data in many
ways to solve programming problems.This chapter will examine a trio of
smaller interesting programs as case studies rather than presenting a unified
case study at the end of the chapter.
LinkedList versus
ArrayList
Iterators
Abstract Data Types (ADTs)
LinkedList
Case Study: Sieve
11.2 Sets
Set Concepts
TreeSet versus HashSet
We'll introduce a new type of list called a linked list that stores its data
differently from an ArrayList but supports the same operations.We'll
also discuss collections called sets that don't allow duplicate elements and
that are easy to search. Another collection type we'll explore is the map,
which creates associations between pairs of data values.We'll also delve
into the notion of abstract data types as a way to separate the capabilities
of a collection from the details of its implementation.
Set Operations
Set Case Study: Lottery
11.3 Maps
Basic Map Operations
Map Views ( keySet and
values )
TreeMap versus HashMap
Map Case Study: WordCount
Collection Overview
679
 
Search WWH ::




Custom Search