Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 

README.md

Java Collections Framework Documentation

Documentation for the Java Collections Framework.

Topics

  • Collection Overview - Introduction to collections
  • Lists - ArrayList, LinkedList, Vector
  • Sets - HashSet, TreeSet, LinkedHashSet
  • Maps - HashMap, TreeMap, LinkedHashMap
  • Queues - Queue and Deque implementations
  • Utilities - Collections and Arrays utilities

Collection Hierarchy

Iterable
  └── Collection
       ├── List (ordered, allows duplicates)
       ├── Set (no duplicates)
       └── Queue (FIFO operations)

Map (key-value pairs, separate hierarchy)

Quick Reference

Common Operations

// List
List<String> list = new ArrayList<>();
list.add("item");
list.get(0);

// Set
Set<Integer> set = new HashSet<>();
set.add(1);
set.contains(1);

// Map
Map<String, Integer> map = new HashMap<>();
map.put("key", 42);
map.get("key");

// Iteration
for (String item : list) {
    System.out.println(item);
}

When to Use What

  • ArrayList: Fast random access, slower insertions/deletions
  • LinkedList: Fast insertions/deletions, slower random access
  • HashSet: Fast lookups, no ordering
  • TreeSet: Sorted set, logarithmic operations
  • HashMap: Fast key-value lookups
  • TreeMap: Sorted map by keys

Learning Path

  1. Understand the collection hierarchy
  2. Learn List implementations and use cases
  3. Study Set characteristics
  4. Master Map operations
  5. Explore Queue and Deque
  6. Use utility classes effectively

Practice Exercises

See the java-collections module for working examples.