Java Collections Framework
The standard library's set of interfaces and classes for groups of objects, chiefly List, Set and Map, and their implementations.
In more detail
The interfaces describe behaviour: a list keeps order and allows duplicates, a set keeps unique members, a map looks values up by key. Declare fields and parameters with the interface, and choose an implementation such as ArrayList or LinkedHashMap for its performance and ordering. Most collections are mutable, so decide who owns each one.
Related terms
- Java List — The collection interface for an ordered sequence of elements that may contain duplicates, with ArrayList as the usual implementation.
- Java Set — The collection interface for a group of unique elements, where adding a duplicate has no effect.
- Java Map — The collection interface that associates each unique key with one value, replacing the old value when a key is stored again.
- defensive copy — A copy of a mutable object, such as a list, made when it crosses a boundary so the other side cannot change your data.
- generics — Types that take other types as parameters, so one definition works for many kinds of value.
Taught in
- The Collections Framework — Modern Java: Virtual Threads & High-Throughput Services
- Generics And Collections — Modern Java: Virtual Threads & High-Throughput Services