Java.util Package
It contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes (a string tokenizer, a random-number generator, and a bit array).
The java.util
package is a built-in package in the Java programming language that provides a collection of utility classes for performing various tasks in Java. Some of the important classes in this package are:
ArrayList
: An implementation of the List interface that allows for dynamic resizing of the list.LinkedList
: An implementation of the List and Queue interfaces that provides a doubly linked list data structure.HashMap
: An implementation of the Map interface that provides a key-value mapping.TreeMap
: An implementation of the SortedMap interface that provides a key-value mapping sorted by the keys.HashSet
: An implementation of the Set interface that provides an unordered collection of unique elements.TreeSet
: An implementation of the SortedSet interface that provides an ordered collection of unique elements.Date
: A class for representing a specific moment in time.Calendar
: A class for manipulating dates and times.Random
: A class for generating random numbers.Scanner
: A class for parsing input from various sources, such as keyboard and files.
These classes and many others in the java.util
package are commonly used in Java programming for a wide range of applications, including data structures, input/output, and date/time manipulation.
Following are the Important Classes in Java.util package :
- AbstractCollection: This class provides a skeletal implementation of the Collection interface, to minimize the effort required to implement this interface.
- AbstractList: This class provides a skeletal implementation of the List interface to minimize the effort required to implement this interface backed by a “random access” data store (such as an array).
- AbstractMap<K,V>: This class provides a skeletal implementation of the Map interface, to minimize the effort required to implement this interface.
- AbstractMap.SimpleEntry<K,V>: An Entry maintaining a key and a value.
- AbstractMap.SimpleImmutableEntry<K,V>: An Entry maintaining an immutable key and value.
- AbstractQueue: This class provides skeletal implementations of some Queue operations.
- AbstractSequentialList: This class provides a skeletal implementation of the List interface to minimize the effort required to implement this interface backed by a “sequential access” data store (such as a linked list).
- AbstractSet: This class provides a skeletal implementation of the Set interface to minimize the effort required to implement this interface.
- ArrayDeque: Resizable-array implementation of the Deque interface.
- ArrayList: Resizable-array implementation of the List interface.
- Arrays: This class contains various methods for manipulating arrays (such as sorting and searching).
- BitSet: This class implements a vector of bits that grows as needed.
- Calendar: The Calendar class is an abstract class that provides methods for converting between a specific instant in time and a set of calendar fields such as YEAR, MONTH, DAY_OF_MONTH, HOUR, and so on, and for manipulating the calendar fields, such as getting the date of the next week.
- Collections: This class consists exclusively of static methods that operate on or return collections.
- Currency: Represents a currency.
- Date: The class Date represents a specific instant in time, with millisecond precision.
- Dictionary<K,V>: The Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to values.
- EnumMap,V>: A specialized Map implementation for use with enum type keys.
- EnumSet: A specialized Set implementation for use with enum types.
- EventListenerProxy: An abstract wrapper class for an EventListener class which associates a set of additional parameters with the listener.
- EventObject: The root class from which all event state objects shall be derived.
- FormattableFlags: FomattableFlags are passed to the Formattable.formatTo() method and modify the output format for Formattables.
- Formatter: An interpreter for printf-style format strings.
- GregorianCalendar: GregorianCalendar is a concrete subclass of Calendar and provides the standard calendar system used by most of the world.
- HashMap<K,V>: Hash table based implementation of the Map interface.
- HashSet: This class implements the Set interface, backed by a hash table (actually a HashMap instance).
- Hashtable<K,V>: This class implements a hash table, which maps keys to values.
- IdentityHashMap<K,V>: This class implements the Map interface with a hash table, using reference-equality in place of object-equality when comparing keys (and values).
- LinkedHashMap<K,V>: Hash table and linked list implementation of the Map interface, with predictable iteration order.
- LinkedHashSet: Hash table and linked list implementation of the Set interface, with predictable iteration order.
- LinkedList: Doubly-linked list implementation of the List and Deque interfaces.
- ListResourceBundle: ListResourceBundle is an abstract subclass of ResourceBundle that manages resources for a locale in a convenient and easy to use list.
- Locale – Set 1, Set 2: A Locale object represents a specific geographical, political, or cultural region.
- Locale.Builder: Builder is used to build instances of Locale from values configured by the setters.
- Objects: This class consists of static utility methods for operating on objects.
- Observable: This class represents an observable object, or “data” in the model-view paradigm.
- PriorityQueue: An unbounded priority queue based on a priority heap.
- Properties: The Properties class represents a persistent set of properties.
- PropertyPermission: This class is for property permissions.
- PropertyResourceBundle: PropertyResourceBundle is a concrete subclass of ResourceBundle that manages resources for a locale using a set of static strings from a property file.
- Random: An instance of this class is used to generate a stream of pseudorandom numbers.
- ResourceBundle: Resource bundles contain locale-specific objects.
- ResourceBundle.Control: ResourceBundle.Control defines a set of callback methods that are invoked by the ResourceBundle.getBundle factory methods during the bundle loading process.
- Scanner: A simple text scanner which can parse primitive types and strings using regular expressions.
- ServiceLoader: A simple service-provider loading facility.
- SimpleTimeZone: SimpleTimeZone is a concrete subclass of TimeZone that represents a time zone for use with a Gregorian calendar.
- Stack: The Stack class represents a last-in-first-out (LIFO) stack of objects.
- StringTokenizer: The string tokenizer class allows an application to break a string into tokens.
- Timer: A facility for threads to schedule tasks for future execution in a background thread.
- TimerTask: A task that can be scheduled for one-time or repeated execution by a Timer.
- TimeZone: TimeZone represents a time zone offset, and also figures out daylight savings.
- TreeMap<K,V>: A Red-Black tree based NavigableMap implementation.
- TreeSet: A NavigableSet implementation based on a TreeMap.
- UUID: A class that represents an immutable universally unique identifier (UUID).
- Vector: The Vector class implements a growable array of objects.
- WeakHashMap<K,V>: Hash table based implementation of the Map interface, with weak keys.
The basic utility classes required by the programmer are provided by this #.
Class | Description |
---|---|
AbstractCollection<E> | The class is used for providing a rough implementation of the Collection interface. The class is declared as: public abstract class AbstractCollection<E> extends Object implements Collection<E> The class methods are extended from the Object class. |
AbstractList<E> | The class is used for providing a rough implementation of the List interface. The class is declared as: public abstract class AbstractList<E> extends AbstractCollection<E> implements List<E> The class methods are extended from the AbstractCollection<E> class. |
AbstractMap<K,V> | The class is used for providing a rough implementation of the List interface. The class is declared as: public abstract class AbstractMap<K,V> extends Object implements Map<K,V> The class methods are extended from the Object class. |
AbstractMap.SimpleEntry<K,V> | The class instance is used for maintaining the value and key. The class is declared as: public static class AbstractMap.SimpleEntry<K,V> extends Object implements Map.Entry<K,V>, Serializable The class methods are extended from the Object class. |
AbstractMap.SimpleImmutableEntry<K,V> | The class instance is used for maintaining the value and key which is immutable. The class is declared as: public static class AbstractMap.SimpleImmutableEntry<K,V> extends Object implements Map.Entry<K,V>, Serializable The class methods are extended from the Object class. |
AbstractQueue<E> | The class is used for providing a rough implementation of the Queue interface. The class is declared as: public abstract class AbstractQueue<E> extends AbstractCollection<E> implements Queue<E> The class methods are extended from the AbstractCollection class. |
AbstractSequentialList<E> | The class is used for providing a rough implementation of the List interface. The class is declared as: public abstract class AbstractSequentialList<E> extends AbstractList<E> The class methods are extended from the AbstractList<E> class. |
AbstractSet<E> | The class is used for providing a rough implementation of the Set interface. The class is declared as: public abstract class AbstractSet<E> extends AbstractCollection<E> implements Set<E> The class methods are extended from the AbstractCollection<E> class. |
ArrayDeque<E> | The class is used for providing a rough implementation of the Deque interface. The class is declared as: public class ArrayDeque<E> extends AbstractCollection<E> implements Deque<E>, Cloneable, Serializable The class methods are extended from the AbstractCollection<E> class. |
ArrayList<E> | The class is used for providing a rough implementation of the List interface. The class is declared as: public class ArrayList<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, Serializable The class methods are extended from the AbstractList<E> class. |
Arrays | The class contains various methods which can be used for the performing large number of operations on arrays. The class is declared as: public class Array extends Object The class methods are extended from the Objetct class. |
BitSet | A vector consisting of bits is created by this class. The class is declared as: public class BitSet extends Object implements Cloneable, Serializable The class methods are extended from the Object class. |
Calendar | It is an abstract class for providing the date time related conversions. The class is declared as: public class BitSet extends Object implements Cloneable, Serializable The class methods are extended from the Object class. |
Collections | The class consists of various methods which is used for performing of various operations on collections in java. The class is declared as: public class Collections extends Object The class methods are extended from the Object class. |
Currency | The class is used for the representation of currency in various dominations.The class is declared as: public final class Currency extends Object implements Serializable The class methods are extended from the Object class. |
Date | The class is used for representation of date. The class is declared as: public class Date extends Object implements Serializable, Cloneable, Comparable The class methods are extended from the Object class. |
Dictionary<K,V> | The following abstract class is a parent of many. It is used for the mapping of key into values. The class is declared as: public abstract class Dictionary<K,V> extends Object The class methods are extended from the Object class. |
EnumMap | The class is a special implementation of Map class designed for enum values. The class is declared as: public class EnumMap extends AbstractMap<K,V> implements Serializable, Cloneable The class methods are extended from the AbstractMap<K,V> class. |
EnumSet | The class is used for providing a rough implementation of the Set interface for the enum values. The class is declared as: public abstract class EnumSet extends AbstractSet<E> implements Cloneable, Serializable The class methods are extended from the AbstractSet<E> class. |
EventListenerProxy | It is the wrapper class for the Event Listener. The class is declared as: public abstract class EventListenerProxy The class methods are extended from the Object class. |
EventObject | All the objects of Event states are derived from this class. The class is declared as: public class EventObject extends Object implements Serializable The class methods are extended from the Object class. |
GregorianCalendar | It is the child class of Calendar class. The class is declared as: public class GregorianCalendar extends Calendar The class methods are extended from the Calendar class. |
HashMap<K,V> | The class is an implementation of the map interface which basically is designed for hash tables. The class is declared as: public class HashMap<K,V> extends AbstractMap<K,V> implements Map<K,V>, Cloneable, Serializable The class methods are extended from the AbstractMap<K,V> class. |
HashSet<E> | The class is an implementation of the set interface which basically is designed for hash tables. The class is declared as: public class HashSet<E> extends AbstractSet<E> implements Set<E>, Cloneable, Serializable The class methods are extended from the AbstractSet<E> class. |
Hashtable<K,V> | Hash table is implemented by this class. The class is declared as: public class Hashtable<K,V> extends Dictionary<K,V> implements Map<K,V>, Cloneable, Serializable The class methods are extended from the Dictionary<K,V> class. |
IdentityHashMap<K,V> | The class is an implementation of the map interface for hash tables. The class is declared as: public class IdentityHashMap<K,V> extends AbstractMap<K,V> implements Map<K,V>, Serializable, Cloneable The class methods are extended from the AbstractMap |
LinkedHashMap<K,V> | The class is an implementation of the map interface for hash tables with linked list. The class is declared as: public class LinkedHashMap<K,V> extends HashMap<K,V> implements Map<K,V> The class methods are extended from the HashMap<K,V> class. |
LinkedHashSet<E> | The class is an implementation of the set interface for hash tables with linked list. The class is declared as: public class LinkedHashSet<E> extends HashSet<E> implements Set<E>, Cloneable, Serializable The class methods are extended from the HashSet<E> class. |
LinkedList<E> | Interfaces such as List and Deque are implemented by using doubly linked list. The class is declared as: public class LinkedList<E> extends AbstractSequentialList<E> implements List<E>, Deque<E>, Cloneable, Serializable The class methods are extended from the AbstractSequentialList<E>class. |
ListResourceBundle | The class is the successor of ResourceBundle which is designed to make the resources available to the locale. The class is declared as: public abstract class ListResourceBundle extends ResourceBundle The class methods are extended from the ResourceBundle class. |
Locale | It is used to reflect a region on space of any type. The class is declared as: public final class Locale extends Object implements Cloneable, Serializable The class methods are extended from the Object class. |
Locale.Builder | Instances of the class are used to make the Locale class objects. The class is declared as: public static final class Locale.Builder extends Object The class methods are extended from the Object class. |
Objects | The various methods of the class are used to manipulate the number of operations to be performed on objects. The class is declared as: public class Objects extends Object The class methods are extended from the Object class. |
Observable | The objects that we can see, monitor or observe are represented by this class. The class is declared as: public class Observable extends Object The class methods are extended from the Object class. |
PriorityQueue<E> | The class represents a priority queue. It is a data structure in which each element has a assigned priority with it. The class is declared as: public class PriorityQueue<E> extends AbstractQueue<E> implements Serializable The class methods are extended from the AbstractQueue<E> class. |
Properties | A wide set of properties are defined by this class. The class is declared as: public class Properties extends Hashtable<Object,Object> The class methods are extended from the Hashtable<Object,Object> class. |
PropertyPermission | Various permissions related to the property of any entity in the program is handled by this class. The class is declared as: public final class PropertyPermission extends BasicPermission The class methods are extended from the BasicPermission class. |
PropertyResourceBundle | It is a child class of the ResoruceBundle class. The class manages the resource allocation to the locale with the specific set of properties. The class is declared as: public class PropertyResourceBundle extends ResourceBundle The class methods are extended from the ResourceBundle class. |
Random | The class instances are used to design a set of random numbers. The class is declared as: public class Random extends Object implements Serializable The class methods are extended from the Object class. |
ResourceBundle | The class contains various objects which are specific to locale. The class is declared as: public abstract class ResourceBundle extends Object The class methods are extended from the Object class. |
Scanner | It is a very important utility class which is used to add user defined values to the class. The class is declared as: public final class Scanner extends Object implements Iterator The class methods are extended from the Object class. |
ServiceLoader<S> | It is a basic service providing class. The class is declared as: public final class ServiceLoader<S> extends Object implements Iterable<S> The class methods are extended from the Object class. |
SimpleTimeZone | The class instances represent time zone to be used with the Georgians Calendar. The class is declared as: public class SimpleTimeZone extends TimeZone The class methods are extended from the TimeZone class. |
Stack<E> | The class represents a data type based on the LIFO principle. The class is declared as: public class Stack<E> extends Vector<E> The class methods are extended from the Vector<E> class. |
StringTokenizer | It is used for creation of various tokens from a string. The class is declared as: public class StringTokenizer extends Object implements Enumeration<Object> The class methods are extended from the Object class. |
Timer | The class provides facility of scheduling of tasks. The class is declared as: public class Timer extends Object The class methods are extended from the Object class. |
TimerTask | The instances of the class represent various tasks which are scheduled using the timer. The class is declared as: public abstract class TimerTask extends Object implements Runnable The class methods are extended from the Object class. |
TimeZone | The instances of the class represent the offset of the time zone. The class is declared as: public abstract class TimeZone extends Object implements Serializable, Cloneable The class methods are extended from the Object class. |
TreeMap<K,V> | It is a map implementation which is based on the tree structure. The class is declared as: public class TreeMap<K,V> extends AbstractMap<K,V> implements NavigableMap<K,V>, Cloneable, Serializable The class methods are extended from the AbstractMap |
UUID | The instances of the class represent UUID. The class is declared as: public final class UUID extends Object implements Serializable, Comparable The class methods are extended from the Object class. |
Vector<E> | The class represents an array of object which can further also be extended. The class is declared as: public class Vector<E> extends AbstractList<E> implements List<E>, RandomAccess, Cloneable, Serializable The class methods are extended from the AbstractList<E> class. |
WeakHashMap<K,V> | The class implements the map interface based on the hash table. The class is declared as: public class WeakHashMap<K,V> extends AbstractMap<K,V> implements Map<K,V> The class methods are extended from the extends AbstractMap<K,V> class. |