Sets
A set is a collection of elements in which the same element does not appear more than once. For example, {A, B, C} is a set, but {A, B, C, A} is not. Unlike a list (Section 5.3), a set does not have any particular ordering: a given element either is or is not a member of the set. Thus, {A, B, C} and {C, B, A} are the same set.
Almost every large program makes use of sets. In this chapter, we present a Set interface (Section 11.1) and three implementations: ordered lists (Section 11.2), binary search trees (Section 11.3), and hash tables (Section 11.4). In Section 11.5, we revisit the Java collections framework, discussing Java's own Set interface, some built-in implementations, and the related Map interface.