Java — Which collection class allows resizing, provides indexed access, but is not synchronized?
Java Programming
Objects and Collections
Difficulty: Easy
Choose an option
-
Ajava.util.HashSet
-
Bjava.util.LinkedHashSet
-
Cjava.util.List
-
Djava.util.ArrayList
Answer
Correct Answer: java.util.ArrayList
Explanation
Introduction / Context:This checks understanding of ArrayList vs other collections in terms of resizing, indexing, and synchronization.
Concept / Approach:
- ArrayList → resizable array, indexed access, not synchronized.
- Vector → synchronized, older alternative.
- HashSet/LinkedHashSet → no indexing, store unique elements.
- List → interface, not a class.
Final Answer:java.util.ArrayList