A Small Intro - Collection in java

What is collection?

A framework that provides an architecture to store and manipulate the group of objects, it gives programmer access to prepackaged data structures as well as algorithms for manipulating them.

→you can perform all the operations on a data such as searching, sorting, insertion, deletion and manipulation by using methods provided by the interfaces present in collection framework.

Now, What are the different interfaces we have in collection?

Image for post
Image for post
collection interfaces with their versions

Mainly we have ( interfaces in collection ….

In list interface we have 3 implementation classes Array, Linked List, Vector and Stack is a part of Vector class(or child class of vector).

Properties of Interface: — -

List — -duplicates are allowed and Insertion order is preserved.

Set — -duplicates are not allowed and Insertion order is not preserved.

Queue — -duplicates are not allowed and Insertion order or some sorting order should be there..

= So, what I want to explain from the above statements is, like when we develop any software, we have some requirements to fulfill So, when our requirements are —

— - we can have duplicate objects and the way we insert every object, they should be present in the same order. So we use list interface methods.

— -we are not allowed to have duplicate objects and the way we insert object , here order is not important . So we use Set interface methods.

— -we want to represent a group of objects (prior to processing ) we use Queue, in that situation.

Above are basic properties of these interfaces.

Advantages of Collection Framework:

  1. Consistent API : The API has a basic set of interfaces like Collection, Set, List, or Map. All classes (ArrayList, LinkedList, Vector, etc) that implement these interfaces have some common set of methods.
  2. Reduces programming effort: A programmer doesn’t have to worry about the design of Collection, and he can focus on its best use in his program.
  3. Increases program speed and quality: Increases performance by providing high-performance implementations of useful data structures and algorithms.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store