Created: 2023-08-26 10:13
Status: #concept
Subject: Programming
Tags: Java Java Package

java.util

It is a standard Java Package that contains Java Classes which we can import into our programs.

List of Commonly-used Packages

  1. java.util.Scanner

  2. java.util.ArrayList

  3. java.util.HashMap

    • a HashMap<T1, T2> helper class for Hashmaps.
  4. java.util.Random

    • allows us to do randomGenerator.nextInt(int bound).
  5. java.util.Arrays

    • contains Arrays static class methods.
  6. java.util.Collectors

    • contains Collectors.toList() and Collectors.toCollectionnew static class methods.
  7. java.util.Collections

    • contains static helper methods to manipulate anything that implements Collections.
    • Collections.sort(ArrayList<T> list) sorts an ArrayList.
  8. java.util.Stream

  9. java.util.Comparable

    • allows us to implements Comparable<T> to define a .compareTo(T obj) method for comparison with java.util.Comparator functions.
  10. java.lang.StringBuilder

    • optimizes string concatenation with .append(String).

References