SlideShare a Scribd company logo
Java.util package contains the collections
framework, legacy collection classes,
event model, date and time facilities,
internationalization, and miscellaneous
utility classes.
Java.util Package
ArrayDeque
 1. ArrayDeque implements Deque interface and
ArrayDeque are available from jdk1.6.
2. Deque is that queue which allows insert and
remove of elements from both sides.
3. ArrayDeque is not thread safe. ArrayDeque
allows unlimited insertion of elements.
Constructor & Description
 ArrayDeque()
 This constructor is used to create an empty array
deque with an initial capacity sufficient to hold 16
elements.
 ArrayDeque(Collection<? extends E> c)
 This constructor is used to create a deque
containing the elements of the specified
collection.
 ArrayDeque(int numElements)
 This constructor is used to create an empty array
deque with an initial capacity sufficient to hold the
specified number of elements.
 boolean add(E e)
 This method inserts the specified element at the end of this
deque.
 void addFirst(E e)
 This method inserts the specified element at the front of
this deque.
 void addLast(E e)
 This method inserts the specified element at the end of this
deque.
 void clear()
 This method removes all of the elements from this deque.
 ArrayDeque<E> clone()
 This method returns a copy of this deque.
 boolean contains(Object o)
 This method returns true if this deque contains the
 The java.util.ArrayList class provides resizable-
array and implements theList interface.Following
are the important points about ArrayList:
 ArrayList class can contain duplicate elements.
 ArrayList class maintains insertion order.
 ArrayList class is non synchronized.
 ArrayList allows random access because array
works at the index basis.
 ArrayList class uses a dynamic array for storing
the elements.It extends AbstractList class and
implements List interface.
 The java.util.Arrays class contains a static
factory that allows arrays to be viewed as
lists.Following are the important points about
Arrays:
 This class contains various methods for
manipulating arrays (such as sorting and
searching).
 The methods in this class throw a
NullPointerException if the specified array
reference is null.
 public class Arrays extends Object
 The java.util.BitSet class implements a vector of bits
that grows as needed.Following are the important
points about BitSet:
 A BitSet is not safe for multithreaded use without
external synchronization.
 All bits in the set initially have the value false.
 Passing a null parameter to any of the methods in a
BitSet will result in a NullPointerException.
 BitSet()
 This constructor creates a new bit set.
 BitSet(int nbits)
 This constructor creates a bit set whose initial size is
large enough to explicitly represent bits with indices in
the range 0 through nbits-1.
 The java.util.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.
 public abstract class Calendar extends Object
implements Serializable, Cloneable,
Comparable<Calendar>
 protected Calendar()
 This constructor constructs a Calendar with the
default time zone and locale.
 protected Calendar(TimeZone zone, Locale
aLocale)
 This constructor constructs a calendar with the
specified time zone and locale.
 The java.util.Dictionary class is the abstract parent of any class, such as Hashtable, which
maps keys to values.Following are the important points about Dictionary:
 java.util.Dictionary class every key and every value is an object.
 java.util.Dictionary object every key is associated with at most one value.
 public abstract class Dictionary<K,V> extends Object
 Dictionary()
 This is the single constructor.
 abstract Enumeration<V> elements()
 This method returns an enumeration of the values in this dictionary.
 abstract V get(Object key)
 This method returns the value to which the key is mapped in this dictionary.
 abstract boolean isEmpty()
 This method tests if this dictionary maps no keys to value.
 abstract Enumeration<K> keys()
 This method returns an enumeration of the keys in this dictionary.
 abstract int size()
 This method returns the number of entries (distinct keys) in this dictionary.
 etc…
 The java.util.EnumMap class is a specialized Map
implementation for use with enum keys.Following are the
important points about EnumMap:
 All of the keys in an enum map must come from a single enum
type that is specified, explicitly or implicitly, when the map is
created.
 Enum maps are maintained in the natural order of their keys.
 EnumMap is not synchronized.If multiple threads access an
enum map concurrently, and at least one of the threads modifies
the map, it should be synchronized externally.
 public class EnumMap<K extends Enum<K>,V> extends
AbstractMap<K,V> implements Serializable, Cloneable
 EnumMap(Class<K> keyType)
 This constructor creates an empty enum map with the specified
key type.
 EnumMap(EnumMap<K,? extends V> m)
 This constructor creates an enum map with the same key type
as the specified enum map, initially containing the same
mappings (if any).
HashMap in Java
 HashMap in Java with Example. HashMap maintains key
and value pairs and often denoted as HashMap<Key,
Value> or HashMap<K, V>.
 HashMap implements Map interface.
 HashMap is similar to Hashtable with two exceptions –
HashMap methods are unsynchornized and it allows null
key and null values unlike Hashtable
 A HashMap contains values based on the key. It
implements the Map interface and extends AbstractMap
class.
 It contains only unique elements.
 It may have one null key and multiple null values.
 It maintains no order.
 public class HashMap<K,V> extends AbstractMap<K,V>
implements Map<K,V>, Cloneable, Serializable
 uses hashtable to store the elements.It extends AbstractSet class and
implements Set interface.
 contains unique elements only.
 Difference between List and Set:
 List can contain duplicate elements whereas Set contains unique
elements only.
 public class HashSet<E> extends AbstractSet<E> implements Set<E>,
Cloneable, Serializable
 HashSet()
 This constructs a new, empty set; the backing HashMap instance has
default initial capacity (16) and load factor (0.75).
 HashSet(Collection<? extends E> c)
 This constructs a new set containing the elements in the specified
collection.
 boolean add(E e)
 This method adds the specified element to this set if it is not already
present.
 void clear()
 This method removes all of the elements from this set.
Java LinkedHashSet class
 Java LinkedHashSet class
 contains unique elements only like HashSet. It extends HashSet class
and implements Set interface.
 maintains insertion order.
 The java.util.LinkedHashSet class is a Hash table and Linked list
implementation of the Set interface, with predictable iteration
order.Following are the important points about LinkedHashSet:
 This class provides all of the optional Set operations, and permits null
elements.
 public class LinkedHashSet<E> extends HashSet<E> implements
Set<E>, Cloneable, Serializable
 LinkedHashSet()
 This constructs a new, empty linked hash set with the default initial
capacity (16) and load factor (0.75).
 LinkedHashSet(Collection<? extends E> c)
 This constructs a new linked hash set with the same elements as the
specified collection.
 This class inherits methods from the following classes:
java.util.Properties
 The java.util.Properties class is a class which represents a persistent
set of properties.The Properties can be saved to a stream or loaded
from a stream.Following are the important points about Properties:
 Each key and its corresponding value in the property list is a string.
 A property list can contain another property list as its 'defaults', this
second property list is searched if the property key is not found in the
original property list.
 This class is thread-safe; multiple threads can share a single Properties
object without the need for external synchronization.
 public class Properties extends Hashtable<Object,Object>
 Advantage of properties file
 Easy Maintenance: If any information is changed from the properties
file, you don't need to recompile the java class. It is mainly used to
contain variable information i.e. to be changed.
 String getProperty(String key)
 This method searches for the property with the specified key in this
property list.

More Related Content

PPSX
JDBC: java DataBase connectivity
PDF
Parse Tree
PPTX
Basic Concepts of OOPs (Object Oriented Programming in Java)
PPTX
Abstract class and Interface
PPTX
Church Turing Thesis
PPT
Java interfaces
PPTX
Threads (operating System)
PPTX
Graph coloring using backtracking
JDBC: java DataBase connectivity
Parse Tree
Basic Concepts of OOPs (Object Oriented Programming in Java)
Abstract class and Interface
Church Turing Thesis
Java interfaces
Threads (operating System)
Graph coloring using backtracking

What's hot (20)

PPTX
JAVA AWT
PPTX
Type casting in c programming
PPT
Shell programming
PDF
Lecture 4 principles of parallel algorithm design updated
PDF
Deadlock Avoidance - OS
PDF
Java threads
PPTX
Congestion on computer network
PPTX
Congestion control
PPTX
PPTX
Threads .ppt
PPTX
DeadLock in Operating-Systems
PDF
Servlet and servlet life cycle
PPTX
Storage management in operating system
PPT
9. Input Output in java
PPTX
Interface in java
PDF
Multithreading
PPTX
MULTI THREADING IN JAVA
PDF
Distributed Operating System_1
PPTX
Unit 1-uses for scripting languages,web scripting
JAVA AWT
Type casting in c programming
Shell programming
Lecture 4 principles of parallel algorithm design updated
Deadlock Avoidance - OS
Java threads
Congestion on computer network
Congestion control
Threads .ppt
DeadLock in Operating-Systems
Servlet and servlet life cycle
Storage management in operating system
9. Input Output in java
Interface in java
Multithreading
MULTI THREADING IN JAVA
Distributed Operating System_1
Unit 1-uses for scripting languages,web scripting
Ad

Similar to Java.util (20)

PPTX
Java util
PDF
Java collections
PDF
java unit 4 pdf - about java collections
PDF
Array list (java platform se 8 )
DOC
Advanced core java
PPT
20 ch22 collections
PDF
Collections Api - Java
PPTX
Nature Activities Binder _ by Slidesgo.pptx
PPT
11000121065_NAITIK CHATTERJEE.ppt
PPT
description of Collections, seaching & Sorting
PDF
Collection framework (completenotes) zeeshan
PPTX
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...
PPTX
Collections
PDF
Java collections
PDF
Java Collection Framework for BCA Students
PPTX
U-III-part-1.pptxpart 1 of Java and hardware coding questions are answered
PPT
M251_Meeting 8 (SetsandMap Advanced Java).ppt
PPT
M251_Meeting 8 (Sets and Maps_Java_).ppt
PPT
Generics collections
DOC
Array properties
Java util
Java collections
java unit 4 pdf - about java collections
Array list (java platform se 8 )
Advanced core java
20 ch22 collections
Collections Api - Java
Nature Activities Binder _ by Slidesgo.pptx
11000121065_NAITIK CHATTERJEE.ppt
description of Collections, seaching & Sorting
Collection framework (completenotes) zeeshan
Collection Framework in Java | Generics | Input-Output in Java | Serializatio...
Collections
Java collections
Java Collection Framework for BCA Students
U-III-part-1.pptxpart 1 of Java and hardware coding questions are answered
M251_Meeting 8 (SetsandMap Advanced Java).ppt
M251_Meeting 8 (Sets and Maps_Java_).ppt
Generics collections
Array properties
Ad

More from Ramakrishna kapa (20)

PPTX
Load balancer in mule
PPTX
Anypoint connectors
PPTX
Batch processing
PPTX
Msmq connectivity
PPTX
Scopes in mule
PPTX
Data weave more operations
PPTX
Basic math operations using dataweave
PPTX
Dataweave types operators
PPTX
Operators in mule dataweave
PPTX
Data weave in mule
PPTX
Servicenow connector
PPTX
Introduction to testing mule
PPTX
Choice flow control
PPTX
Message enricher example
PPTX
Mule exception strategies
PPTX
Anypoint connector basics
PPTX
Mule global elements
PPTX
Mule message structure and varibles scopes
PPTX
How to create an api in mule
PPTX
Log4j is a reliable, fast and flexible
Load balancer in mule
Anypoint connectors
Batch processing
Msmq connectivity
Scopes in mule
Data weave more operations
Basic math operations using dataweave
Dataweave types operators
Operators in mule dataweave
Data weave in mule
Servicenow connector
Introduction to testing mule
Choice flow control
Message enricher example
Mule exception strategies
Anypoint connector basics
Mule global elements
Mule message structure and varibles scopes
How to create an api in mule
Log4j is a reliable, fast and flexible

Recently uploaded (20)

PDF
top salesforce developer skills in 2025.pdf
PDF
PTS Company Brochure 2025 (1).pdf.......
PPTX
history of c programming in notes for students .pptx
PDF
How Creative Agencies Leverage Project Management Software.pdf
PDF
2025 Textile ERP Trends: SAP, Odoo & Oracle
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
PDF
medical staffing services at VALiNTRY
PDF
Internet Downloader Manager (IDM) Crack 6.42 Build 41
PDF
AI in Product Development-omnex systems
PDF
How to Migrate SBCGlobal Email to Yahoo Easily
PDF
Softaken Excel to vCard Converter Software.pdf
PDF
System and Network Administration Chapter 2
PPTX
ISO 45001 Occupational Health and Safety Management System
PDF
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
PPTX
L1 - Introduction to python Backend.pptx
PPT
Introduction Database Management System for Course Database
PPTX
Operating system designcfffgfgggggggvggggggggg
PDF
Adobe Illustrator 28.6 Crack My Vision of Vector Design
PDF
System and Network Administraation Chapter 3
PPTX
VVF-Customer-Presentation2025-Ver1.9.pptx
top salesforce developer skills in 2025.pdf
PTS Company Brochure 2025 (1).pdf.......
history of c programming in notes for students .pptx
How Creative Agencies Leverage Project Management Software.pdf
2025 Textile ERP Trends: SAP, Odoo & Oracle
Internet Downloader Manager (IDM) Crack 6.42 Build 42 Updates Latest 2025
medical staffing services at VALiNTRY
Internet Downloader Manager (IDM) Crack 6.42 Build 41
AI in Product Development-omnex systems
How to Migrate SBCGlobal Email to Yahoo Easily
Softaken Excel to vCard Converter Software.pdf
System and Network Administration Chapter 2
ISO 45001 Occupational Health and Safety Management System
Addressing The Cult of Project Management Tools-Why Disconnected Work is Hold...
L1 - Introduction to python Backend.pptx
Introduction Database Management System for Course Database
Operating system designcfffgfgggggggvggggggggg
Adobe Illustrator 28.6 Crack My Vision of Vector Design
System and Network Administraation Chapter 3
VVF-Customer-Presentation2025-Ver1.9.pptx

Java.util

  • 1. Java.util package contains the collections framework, legacy collection classes, event model, date and time facilities, internationalization, and miscellaneous utility classes. Java.util Package
  • 2. ArrayDeque  1. ArrayDeque implements Deque interface and ArrayDeque are available from jdk1.6. 2. Deque is that queue which allows insert and remove of elements from both sides. 3. ArrayDeque is not thread safe. ArrayDeque allows unlimited insertion of elements.
  • 3. Constructor & Description  ArrayDeque()  This constructor is used to create an empty array deque with an initial capacity sufficient to hold 16 elements.  ArrayDeque(Collection<? extends E> c)  This constructor is used to create a deque containing the elements of the specified collection.  ArrayDeque(int numElements)  This constructor is used to create an empty array deque with an initial capacity sufficient to hold the specified number of elements.
  • 4.  boolean add(E e)  This method inserts the specified element at the end of this deque.  void addFirst(E e)  This method inserts the specified element at the front of this deque.  void addLast(E e)  This method inserts the specified element at the end of this deque.  void clear()  This method removes all of the elements from this deque.  ArrayDeque<E> clone()  This method returns a copy of this deque.  boolean contains(Object o)  This method returns true if this deque contains the
  • 5.  The java.util.ArrayList class provides resizable- array and implements theList interface.Following are the important points about ArrayList:  ArrayList class can contain duplicate elements.  ArrayList class maintains insertion order.  ArrayList class is non synchronized.  ArrayList allows random access because array works at the index basis.  ArrayList class uses a dynamic array for storing the elements.It extends AbstractList class and implements List interface.
  • 6.  The java.util.Arrays class contains a static factory that allows arrays to be viewed as lists.Following are the important points about Arrays:  This class contains various methods for manipulating arrays (such as sorting and searching).  The methods in this class throw a NullPointerException if the specified array reference is null.  public class Arrays extends Object
  • 7.  The java.util.BitSet class implements a vector of bits that grows as needed.Following are the important points about BitSet:  A BitSet is not safe for multithreaded use without external synchronization.  All bits in the set initially have the value false.  Passing a null parameter to any of the methods in a BitSet will result in a NullPointerException.  BitSet()  This constructor creates a new bit set.  BitSet(int nbits)  This constructor creates a bit set whose initial size is large enough to explicitly represent bits with indices in the range 0 through nbits-1.
  • 8.  The java.util.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.  public abstract class Calendar extends Object implements Serializable, Cloneable, Comparable<Calendar>  protected Calendar()  This constructor constructs a Calendar with the default time zone and locale.  protected Calendar(TimeZone zone, Locale aLocale)  This constructor constructs a calendar with the specified time zone and locale.
  • 9.  The java.util.Dictionary class is the abstract parent of any class, such as Hashtable, which maps keys to values.Following are the important points about Dictionary:  java.util.Dictionary class every key and every value is an object.  java.util.Dictionary object every key is associated with at most one value.  public abstract class Dictionary<K,V> extends Object  Dictionary()  This is the single constructor.  abstract Enumeration<V> elements()  This method returns an enumeration of the values in this dictionary.  abstract V get(Object key)  This method returns the value to which the key is mapped in this dictionary.  abstract boolean isEmpty()  This method tests if this dictionary maps no keys to value.  abstract Enumeration<K> keys()  This method returns an enumeration of the keys in this dictionary.  abstract int size()  This method returns the number of entries (distinct keys) in this dictionary.  etc…
  • 10.  The java.util.EnumMap class is a specialized Map implementation for use with enum keys.Following are the important points about EnumMap:  All of the keys in an enum map must come from a single enum type that is specified, explicitly or implicitly, when the map is created.  Enum maps are maintained in the natural order of their keys.  EnumMap is not synchronized.If multiple threads access an enum map concurrently, and at least one of the threads modifies the map, it should be synchronized externally.  public class EnumMap<K extends Enum<K>,V> extends AbstractMap<K,V> implements Serializable, Cloneable  EnumMap(Class<K> keyType)  This constructor creates an empty enum map with the specified key type.  EnumMap(EnumMap<K,? extends V> m)  This constructor creates an enum map with the same key type as the specified enum map, initially containing the same mappings (if any).
  • 11. HashMap in Java  HashMap in Java with Example. HashMap maintains key and value pairs and often denoted as HashMap<Key, Value> or HashMap<K, V>.  HashMap implements Map interface.  HashMap is similar to Hashtable with two exceptions – HashMap methods are unsynchornized and it allows null key and null values unlike Hashtable  A HashMap contains values based on the key. It implements the Map interface and extends AbstractMap class.  It contains only unique elements.  It may have one null key and multiple null values.  It maintains no order.  public class HashMap<K,V> extends AbstractMap<K,V> implements Map<K,V>, Cloneable, Serializable
  • 12.  uses hashtable to store the elements.It extends AbstractSet class and implements Set interface.  contains unique elements only.  Difference between List and Set:  List can contain duplicate elements whereas Set contains unique elements only.  public class HashSet<E> extends AbstractSet<E> implements Set<E>, Cloneable, Serializable  HashSet()  This constructs a new, empty set; the backing HashMap instance has default initial capacity (16) and load factor (0.75).  HashSet(Collection<? extends E> c)  This constructs a new set containing the elements in the specified collection.  boolean add(E e)  This method adds the specified element to this set if it is not already present.  void clear()  This method removes all of the elements from this set.
  • 13. Java LinkedHashSet class  Java LinkedHashSet class  contains unique elements only like HashSet. It extends HashSet class and implements Set interface.  maintains insertion order.  The java.util.LinkedHashSet class is a Hash table and Linked list implementation of the Set interface, with predictable iteration order.Following are the important points about LinkedHashSet:  This class provides all of the optional Set operations, and permits null elements.  public class LinkedHashSet<E> extends HashSet<E> implements Set<E>, Cloneable, Serializable  LinkedHashSet()  This constructs a new, empty linked hash set with the default initial capacity (16) and load factor (0.75).  LinkedHashSet(Collection<? extends E> c)  This constructs a new linked hash set with the same elements as the specified collection.  This class inherits methods from the following classes:
  • 14. java.util.Properties  The java.util.Properties class is a class which represents a persistent set of properties.The Properties can be saved to a stream or loaded from a stream.Following are the important points about Properties:  Each key and its corresponding value in the property list is a string.  A property list can contain another property list as its 'defaults', this second property list is searched if the property key is not found in the original property list.  This class is thread-safe; multiple threads can share a single Properties object without the need for external synchronization.  public class Properties extends Hashtable<Object,Object>  Advantage of properties file  Easy Maintenance: If any information is changed from the properties file, you don't need to recompile the java class. It is mainly used to contain variable information i.e. to be changed.  String getProperty(String key)  This method searches for the property with the specified key in this property list.