Java: Collections Class
This page discusses - Java: Collections Class.
Map Iteration
No direct iteration over Maps -- Get Set of keys or key-value pairs from Mapt.
Java: Maps
Map implemented by HashMap and TreeMap.
Java: Sets
Sets are collections that allow only one object with a given value in them..
Old and New Vector Methods
The Vector class was updated to implement the List interface..
Java Notes: Vectors
To Create a Vector.
ArrayList (non-generic)
An ArrayList can be traversed using either iterators or indexes..
ArrayList
An ArrayList has methods for inserting, deleting, and searching..
Comparators
The primary use of comparators is to pass them to something that does sorting, either one of the explicit sort methods, or to a data structure than implicitly sorts..
Iterators
Iterator is a replacement for the Enumeration class which was used before collections were added to Java..
Collections Class
The java.util.Collections class contains static utility methods for manipulating collections..
Collection Interface
The Collection interface is the parent of the List and Set interfaces, but not Map..
Set<E> interface
The java.util.Set<E> interface is a subinterface of Collection<E>..
Programming - WordFrequency modifications
The purpose of these exercises is to get practice with using some of the basic data structures..
Java: Map Iteration
No direct iteration over Maps -- Get Set of keys or key-value pairs from Mapt.
Java: Maps
Key-value pairs are stored in maps..
Example - WordFrequency
This program reads files of words and lists their frequencies..
Java Notes: Vectors
Vectors can hold only Objects and not primitive types (eg, int)..
Simple Linked Lists
A simple singly-linked list. This shows the basics..
Simple Linked List Exercise 1
Simple Linked List Exercise 1.
ArrayList
An ArrayList automatically expands as data is added..
ArrayList<E>
An ArrayList automatically expands as data is added..
Collections Exercise 2a - State Capital Output
The solution to mapping from a state code (eg, "MI", "NY", ...) to its capital city ("Lansing", "Albany", ...) is to use a HashMap..
Collections Exercise 4 - Word Translator
The user will enter a word and the program will produce a list of "translations"..
Collections Exercise 4 - Word Translator (Generics)
For passing over the elements of a data structure, consider only Iterator and for loop..
Collections Exercise 3 - Points
For passing over the elements of a data structure, consider only Iterator and for loop..
Collections Exercise 2 - State Capitals
For the purposes of this exercise, the only data structures that need to be considered are: array, ArrayList, LinkedList, HashSet, TreeSet, HashMap, and TreeMap..
Collections Exercise 1 - Unique Components
For the purposes of this exercise, the only data structures that need to be considered are: array, ArrayList, LinkedList, HashSet, TreeSet, HashMap, and TreeMap..
Collections (Data Structure Library)
Predefined Libraries.
Java 5 Features
To resources on new Collections features.
Iterators
The List and Set collections provide iterators..
Java Notes: Generics
You generally won't define generic classes and methods yourself, but you do have to understand how and why they are used..
Alternative Data Structures
These packages address several shortcomings of the Java Collections data structures..
Java Notes: Downcasting
There are a lot of things to like about Java Collections, but there are some weak aspects too..
Comparators
The primary use of comparators is to pass them to something that does sorting, either one of the explicit sort methods, or to a data structure than implicitly sorts (eg, TreeSet or TreeMap)..
Class or Interface
Declare variables as class or interface type?.
Collection Interface
The Collection interface is the parent of the List and Set interfaces, but not Map..
Collections Overview
Summary of Collections interfaces.
Java Data Structures
The overall term for Java's data structure facilities is Collections, a term is is an alternative to the more common Data Structures..