Chapter 11. Data Structures: Collections and Generics
Sorting is a snap in Java. You have all the tools for collecting and manipulating your data without having to write your own sort algorithms (unless youâre reading this right now sitting in your Computer Science 101 class, in which case, trust usâyou are SO going to be writing sort code while the rest of us just call a method in the Java API). In this chapter, youâre going to get a peek at when Java can save you some typing and figure out the types that you need.
The Java Collections Framework has a data structure that should work for virtually anything youâll ever need to do. Want to keep a list that you can easily keep adding to? Want to find something by name? Want to create a list that automatically takes out all the duplicates? Sort your co-workers by the number of times theyâve tried to speak with their mic muted on a video call? Sort your pets by number of tricks learned? Itâs all here...
Tracking song popularity on your jukebox
Congratulations on your new jobâmanaging the automated jukebox system at Louâs Diner. Thereâs no Java inside the jukebox itself, but each time someone plays a song, the song data is appended to a simple text file.
Your job is to manage the data to track song popularity, ...
Get Head First Java, 3rd 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.