The java.util package is part of java.base module. This package contains the most important APIs and classes in Java.
Contents of java.util Package
Java util package contains the following classes and APIs:
- Collections Framework
- Concurrent Classes
- Functional Interfaces
- Regex Classes
- Stream API
- ZIP API
- Internationalization Support Classes
- Service Loader
- Properties API
- Random Number Generation API
- String Parsing and Scanning
- Base64 Encoding and Decoding Classes
- Legacy Date and Time Classes
- Miscellaneous Exceptions and Utility Classes
Important Interfaces in java.util Package
Let’s look at some of the important interfaces in the java.util package.
- Collection: The root interface of the Collections API.
- Comparator: Used to implement sorting logic for the objects.
- Queue and Deque: Queue and Double ended Queue
- Iterator: implemented by the Collections classes to provide iteration logic.
- List
- ListIterator
- Map
- Set
Important Classes in java.util Package
- ArrayList
- Base64
- Calendar
- GregorianCalendar
- Date
- EnumMap
- EnumSet
- HashMap
- HashSet
- Hashtable
- LinkedList
- Optional
- PriorityQueue
- Properties
- ResourceBundle
- TreeMap
- TreeSet
Utility Classes in java.util Package
- Arrays
- Collections
- Formatter
- Scanner
- Random
- Timer, TimerTask
- UUID
- StringJoiner
- StringTokenizer
Exceptions in java.util Package
- ConcurrentModificationException
- EmptyStackException
- IllformedLocaleException
- InputMismatchException
- MissingResourceException
- NoSuchElementException
- PatternSyntaxException
- ZipException, JarException
- IllegalFormatException