Questions and Exercises: Implementations
Questions
1. You plan to write a program that uses several basic collection interfaces: Set
, List
, Queue
, and Map
. You’re not sure which implementations will work best, so you decide to use general-purpose implementations until you get a better idea of how your program will work in the real world. Which implementations are these?
2. If you need a Set
implementation that provides value-ordered iteration, which class should you use?
3. Which class do you use to access wrapper implementations?
Exercise
1. Write a program that reads a text file, specified by the first command-line argument, into a List
. The program should then print random lines from the file, with the number of lines printed specified ...
Get The Java® Tutorial: A Short Course on the Basics, 6th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.