In this lecture we cover ordered and navigable Java collections:
NavigableSet and
NavigableMap. In practice, we’ll see how to work with ranges via
subSet/
headSet/
tailSet, find “nearest” elements using
lower,
floor,
ceiling,
higher, and manage the ends via
pollFirst/
pollLast. We’ll examine reverse views
descendingSet/
descendingMap, “live” views, and typical use cases (schedules, priorities, scales). As implementations we’ll use
TreeSet and
TreeMap.