Collections

A collection is an object that represents a group of objects. You can use collections to represent relationships among objects. These relationships can be between one object and another object (one-to-one), one object and many other objects (one-to-many), or many objects and many other objects (many-to-many). A simple array can be used to represent a one-to-one relationship. Special collection classes are essential when you want to represent one-to-many and many-to-many relationships.

Collections can be gathered together in many different ways. The way you represent a collection of objects largely depends on the kinds of objects you're collecting and what you want to do with them. There are five types of collections available in ...

Get JavaBeans Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.