Collections Framework:
The Collections framework provides a set of interfaces, implementations, and algorithms to handle collections of objects efficiently. It includes classes like List, Set, Map, and provides operations like adding, removing, and searching elements.
java
// Example: Using a List
import java.util.ArrayList;
import java.util.List;
public class Main {
public static void main(String[] args) {
List<String> names = new ArrayList<>();
names.add("Alice");
names.add("Bob");
names.add("Charlie");
for (String name : names) {
System.out.println(name);
}
}
}
No comments:
Post a Comment