Java Programming - Objects and Collections - Discussion

Discussion Forum : Objects and Collections - General Questions (Q.No. 7)
7.
Which collection class allows you to associate its elements with key values, and allows you to retrieve objects in FIFO (first-in, first-out) sequence?
java.util.ArrayList
java.util.LinkedHashMap
java.util.HashMap
java.util.TreeMap
Answer: Option
Explanation:

LinkedHashMap is the collection class used for caching purposes. FIFO is another way to indicate caching behavior. To retrieve LinkedHashMap elements in cached order, use the values() method and iterate over the resultant collection.

Discussion:
2 comments Page 1 of 1.

Navya said:   9 years ago
I think the java.util.hashmap also the correct answer.

Akbar said:   9 years ago
"FIFO is another way to indicate caching behavior".

What does FIFO has to do with caching behavior?

Post your comments here:

Your comments will be displayed after verification.