The very first question of the review questions section in chapter 3 says,
You have a collection of products for sale in a database and you need to display those products. The products are not unique. Which of the following collections classes in the java.util package best suit your needs for this scenario?
My answer was (B,E). But the correct answer is marked only for (B). The explanation given is not clear about why we eliminated the LinkedList from the answers.
Explanation as follows:
The answer needs to implement List because the scenario allows duplicates. Since you need a List, you can eliminate C, D and E immediately. HashMap is a Map and HashSet is a Set. LinkedList is both a List and a Queue.
Yes, LinkedList can act as both a List and a Queue. So, LinkedList can be a List. It also can be a queue. Both List and Queue allow duplicates. If we are looking for a List, then why LinkedList (which is qualified as a List) is removed?
It's not an errata. The question asks which class *best* suits your needs. The idea was to choose one that best suits your needs. ArrayList is better than LinkedList if you don't need the Queue functionality because it will be faster.