DEV Community

Vishnu N
Vishnu N

Posted on

Collections in Java

What are collections?
-Collections in Java is a framework that provides classes and interfaces to store and manipulate groups of objects dynamically.
-It is part of java.util package.

Why do we use collections?

Before collections:
-We used arrays.
-Arrays are fixed size.
-Cannot easily insert/delete elements.
**
After collections:**
-Dynamic size.
-Built-in methods.
-Better performance handling.

What is a collection? (Java Collection Framework)

  • Collection is an interface.
  • It is the root interface of List, Set, and Queue.
  • Map is NOT a child of Collection.

Main Interfaces in collection:

  • List.
  • Set.
  • Queue.
  • Map.

Top comments (0)