The Java Collections Framework (JCF) is a unified architecture that provides ready-made classes and interfaces to store, manipulate, and process groups of objects efficiently.
java.util packageType a value to add(). Click an item to remove().
Collection interfaces define behavior, while concrete classes like ArrayList, HashSet, and HashMap provide implementations.
// Importing the Collections package
import java.util.*;
// Main class
class CollectionDemo {
public static void main(String[] args) {
// Creating a List using ArrayList
List names = new ArrayList<>();
names.add("Java");
names.add("Python");
names.add("C++");
// Printing the list
System.out.println(names);
}
}
The ArrayList stores elements in insertion order. When printed, all added elements appear sequentially.
List, Set) instead of concrete classesSet to store unique numbersMap to store student name and marksArrayList with LinkedList and observe behavior