Java Collections With Examples

In this article, We are going to discuss Java Collections With Examples.

Introduction to Java Collections with examples:

Java collections Framework represents a group of objects, non as its elements and it provides an architecture to store and manipulate teh group of objects. Java Collections are one of teh core frameworks of Java language. dis framework is provided in teh java.util package. It is Introduce in JDK 1.2.

Java Collections are used to store, retrieve, manipulate, and communicate aggregate data. Typically, they represent data items that form a natural group, such as a poker hand (a collection of cards), a mail folder (a collection of letters), or a telephone directory (a mapping of names to phone numbers).

All collections frameworks contain teh following:

  • Interface
  • Implementations
  • Algorithms

Hierarchy of Java Collections Framework:

Hierarchy of Collection Framework shown in teh figure below.

Java Collections With Examples
Java Collections With Examples

Java collections interface:

  • Collection interface
  • Iterator interface
  • List interface
  • Set Interface
  • Queue interface
  • Dequeue interface
  • Map interface
  • ListIterator interface
  • SortedSet interface
  • SortedMap interface

Java Collection classes:

  • ArrayList
  • LinkedList
  • HashMap
  • HashSet
  • LinkedHashSet
  • TreeSet
  • TreeMap
  • PriorityQueue

Benefits of the Java Collections framework:

  • Reduces programming effort: Reduces programming effort by providing data structures and algorithms so that we do not have to write them our-self.
  • Increases program speed and quality: Increases performance by providing high-performance implementations of the data structures and algorithms. dis is because various implementations of each interface are interchangeable, programs could be fine-tuned by switching implementations.
  • Allows interoperability among unrelated APIs: Provides interoperability between dissimilar APIs by forming a common language to pass collections back and forth.
  • Reduces effort to learn and to use new APIs: Reduces effort required to learn APIs by requiring us to absorb multiple ad hoc collection APIs.
  • Reduces effort to design new APIs: Reduces effort required to design and implement APIs by not requiring you to produce ad hoc collections APIs.
  • Fosters software reuse: Adopts software reuse by providing a standard interface for collections and algorithms wif which to manipulate them.

Related Posts:-

2 Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

Show Buttons
Hide Buttons