Java Collection Framework

Iterable Interface

Collection Interface

List Interface

Array List

  • Array has fixed size length while the size of Array List is dynamic.
  • Array used to represent via [] while Array List represent via different methods.
  • Array is faster than using the Array List since it has fixed size length.
  • In Arrays we use for loop for iteration purpose while Array List has a method called iterator() to iterate elements.

Linked List

  • Array List is dynamic array while Linked List is a doubly linked list.
  • Array List is slower than the Linked List since it need to shift the elements when we try to add or remove the elements.
  • Array is used for storing or accessing while Linked List useful for manipulating data.

Vector

Stack

Queue

Dequeue

Array Dequeue

Priority Queue

Set

Hashed Set

Linked Hash Set

  • The default constructor: LinkedHashSet()
  • Constructor with the element of collection: LinkedHashSet(Collection c)
  • Constructor with the size of linked hash set: LinkedHashSet(int size)
  • Constructor with capacity+load capacity: LinkedHashSet(int size, float load_capacity)

Sorted Set

Tree Set

  • The default constructor: TreeSet()
  • Constructor with the element of collection: TreeSet (Collection<? extends E >c)
  • Constructor with empty set which is sorted according to the constructor in future: (Comparator<? super E >Comparator)
  • Constructor with the sorted elements: TreeSet(SortedSet<E> s)

Stay Safe !!!

--

--

--

Associate Software Engineer at Virtusa.

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

NaNo Day 17 — Project Life: Additional Objectives & Tileset Integration

Import/Onboardi Experience Project — Fruits of the Labour

Streaming with JPAstreamer

Dome9 Brings Best-in-Class Security Intelligence to Microsoft Azure

d9_clarity_azure

Migrating a Dispatcher Configuration from Managed Services to AEM as a Cloud Service

Plan on long sales cycles for software designed to enable enterprise migrations to the cloud

Let’s “ls -l” So You Can Learn Shell

How to use Google Sheets API

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
Sanduni Jayaweera

Sanduni Jayaweera

Associate Software Engineer at Virtusa.

More from Medium

Split function in Java Programming

Exception Handling in Java

Priority Queue in Java

OOP Concepts in Java