Generics and Collections
Organizing data is another important software development topic. Java hands us collections to deal with various data structures. It also gives us generics to achieve type safety and avoid duplicate code in our applications. We cannot say we’re masters of Java without understanding how to use collections and generics.
That’s why we devoted this chapter to the Java collections framework. In this chapter, we’ll cover the following topics:
- The collections framework and its interfaces –
List
,Set
,Map
, andQueue
- Several implementations of each collection type and their basic operations
- Sorting collections using natural ordering and the
Comparable
andComparator
interfaces - Working with generics
- Basic hashing concepts and their relevance
By the end of this chapter, you will have a solid understanding of the Java collections framework and generics, and you’ll be ready to manage data and use collections...