Introduction About Java Collection

November 19, 2018 , , 0 Comments

History of Java Collection

The collections framework in Java was enthusiastically designed by Java engineers to specially meet the goals that they had envisaged.
Their vision was to have-

  • The Java framework that could prove to be high-performance and low-maintenance. The implementations necessary for the purpose of fundamental collections (dynamic arrays, linked lists, trees, and hash tables) were required to be highly efficient.
  • The framework had to consent to work, store and process different types of collections to work in a parallel manner and with a high amount of interoperability.
  • The framework had to expand and/or adapt to a given collection without difficulty.

Core Java Collections Framework 

The collection is a representation of a group of objects. Solely depending on the process which has been used for the storing and retrieving, core collections are basically divided into three parts –
Java Collection framework
  • Set a Set collection of your framework does not contain duplicate values,
  • List– List collection can contain the duplicate values which are stored in it sequentially.
  • Queue– Queue collection contains an ordered list of objects with its usage specifically limited to inserting of the elements at the end of the list

The ingredients of a Java Collection Framework? 

A collections framework in Java is an amalgamated architecture for demonstrating java collections.
Java Collection framework
All of the collections frameworks of Java comprise of the following –
  • Interfaces− Interfaces are abstract type data that usually represents the collections. Interfaces agree to the collections to be maneuvered autonomously of the particulars of their demonstration. In languages like Java or we can say object-oriented languages, interfaces usually form a hierarchy.
  • Implementations or Classes− These are the tangible implementations of the Java collection interfaces. In real meaning, they are data structures which are reusable.
  • Algorithms− Algorithms are the methods that carry out useful data processing, such as probing and categorization, on various objects that put into practice the Java collection interfaces. The algorithms are known to be polymorphic meaning thereby that the identical method can be easily used for many different implementations of the proper collection interface.
In addition to the collections, this framework defines a number of map interfaces and java classes. Maps are the collection that store key/value pairs. Although maps are not collections per se in the proper usage of this term, they are fully incorporated into collections. A map of a java collection cannot hold duplicate keys; which means that each key can map only to one value at most.

Java Collection Framework Hierarchy Elements

Here is a list of various elements given in the screenshot below along with their descriptions-
Java Collection framework

ArrayList

This element tools all of the optional list operations, and allows all the elements, including the null ones. In addition to executing the List interface, this class supplies various methods to maneuver the size of the given array that is used inside to store the list.

Vector

This class is approximately corresponding to ArrayList apart from the fact that it is coordinated.

LinkedList

Linked list implements elements of both parts of a collection ie List as well as the Queue interfaces.  It seamlessly executes all controlled operations and allows all the elements together with the null elements.

Priority Queues

Priority queues are the queues that order elements in consonance to an abounding comparator or in the nature of the elements’ natural order. 

HashSet 

This class executes the Set part of the collection interface and is substantially backed by a hash table (actually a HashMap instance). Though it makes no guarantees with regard to the iteration order of the set part; in particular, it does not promise that the order will remain intact for good, over the time. This class also permits the null elements of the interface.

LinkedHashSet

Hash table and linked list execution of the Set framework, with conventional iteration order. This execution differs from HashSet in that it supports and takes care of a doubly-linked list managing all the way through all of its entries.

TreeSet

Treeset allows an easy execution of the Set interface that utilizes a tree kind of structure for storage. Objects are stored in a well organized and ascending order. Admission and recovery times are fairly fast, which make TreeSet an outstanding choice when storing of large amounts of sorted data sets that must be found swiftly.

Java Collection Maps

Without the Map interface, the collection is not complete.The Java collection classes encompass of two main root interfaces of Java collection classes. One is The Collection interface (java.util.Collection) and the other is the Map interface (java.util.Map)
Java Collection framework
  • AbstractMap: Executes almost all the parts of the Map interface.
  • HashMap: The HashMap class utilizes a hashtable to substantially execute the Map interface.
  • TreeMap: Stretch the AbstractMap to utilize a tree structure.
  • WeakHashMap: Stretches the AbstractMap to utilize a hash table with scrawny keys.
  • LinkedHashMap: Stretches a HashMap to permit insertion-order iterations.
  • IdentityHashMap: Stretches an AbstractMap and utilizes orientation equal opportunity when comparing several documents. 

Unknown

Some say he’s half man half fish, others say he’s more of a seventy/thirty split. Either way he’s a fishy bastard. Google

0 comments:

Hot-product

Best Watch Store

Popular Posts

Contact Form

Name

Email *

Message *