Join David Gassner for an in-depth discussion in this video Managing ordered sets with TreeSet, part of Java Advanced Training.
In a previous video I described how to use the HashSet, a collection class…that lets you store references to objects and ensures that each reference is only stored once.…Now I'm going to show how to use TreeSet.…The TreeSet implements everything the HashSet does, but it also keeps everything…in an order that you can control by implementing an interface called comparable…in the class that you're storing.…I'm going to start by creating an instance of the TreeSet class and then I'll…show you how to code so that objects are stored in an order that you control.…
In this class I've declared three instances of subclasses of the Olive class,…Ligurio, Kalamata, and Picholine.…Notice that I haven't put them explicitly in any alphabetical order.…I put L before K, P at the end, but the goal is to show eventually that when I…add objects to a TreeSet that they will automatically be alphabetized.…I'll start with the cursor below the existing code inside the main method.…I'll declare an instance of the TreeSet class.…
- Installing Java on Windows and Mac OS X
- Installing Eclipse
- Using new features such as simplified generics
- Working with advanced class structures (member, local inner, etc.)
- Using the Reflection API
- Navigating inheritance trees
- Managing unordered and ordered sets
- Peeking and polling with queues
- Testing and error handling
- Managing files and directories
- Working with I/O streams
- Next steps with Java
Skill Level Advanced
1. Getting Started
2. Java 7 New Features
3. Using Advanced Class Structures
4. Using the Reflection API
5. More of the Collections Framework
6. Testing and Advanced Exception Handling
Using the finally keyword5m 40s
7. Managing Files and Directories in Java 7
8. Working with I/O Streams
9. Working with Multi-threading
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.