Jul 22, 2024
java.util
package.java.lang
package.Iterable
and cannot be instantiated directly.
**List Iterator: **
Iterator
.hasPrevious
, previous
.Deque
, can function as both stack and queue.Deque
, use for FIFO queues.hashCode
and equals
methods.NavigableMap
for additional navigation methods.ceilingEntry
, floorEntry
, higherEntry
, lowerEntry
.HashMap
.Comparable
: Implement in class, provides natural ordering via compareTo
method.Comparator
: Implement separately, used for total ordering via compare
method.Comparable
for natural ordering.Comparator
for custom total orderings, such as reverse order.Integer
instead of int
).Integer
to int
and vice versa.Arrays.sort
, Collections.sort
.Arrays.asList
, List.toArray
.Key Takeaways:
hashCode
and equals
for use in sets and maps.Comparable
and Comparator
for custom object sorting.Next Steps: