SteelReed

Search

Search posts, questions…

Collections & DSAQuestion 1 / 25

Junior

What is in the Java Collections Framework? How do List, Set, Map and Queue differ?

Short answer

The Collections Framework is the set of interfaces and classes in java.util for holding groups of objects: List, Set, Queue, Map. Choose by the operation you call most.

iterate, by indexalready there?lookup by key, countqueue, stacksmallest firstMost frequent operation?ArrayListHashSetHashMapArrayDequePriorityQueue

3 points to say:

  1. Code against interfaces, e.g. List.
  2. Map is not a Collection.
  3. Choose by operation, not by habit.

Keep reading the deep dive

Create a free account to read the full explanation and follow-up questions, mark questions as studied and review them on a schedule.