- To introduce implementations of Set interface
- To check whether Sets allow duplicates
- To introduce the add and remove operations on Sets
- To introduce the union and difference operations on Sets
- To develop counting duplicates application
- To introduce LinkedHashSet’s insertion ordering
- To introduce TreeSet’s red black tree implementation
Sets are the third type of Java containers we are going to deal with in this book. Having seen Lists and Map types, we might have observed that lists and maps allow duplicate values. However there are many situations where we need to hold only unique elements. This is where sets score better. In this chapter, the readers will be introduced to Set interface ...