package com.michaelthomas.set.treeset; /** * @author Michael Thomas (www.michael-thomas.com) michael@michael-thomas.com * */ import java.util.Set; import java.util.TreeSet; public class MyTreeSet { //NOTE: For learning, you must see the JUnit test file in the /test/ directory and matching package! Set buildTreeSetCarVendors1() { Set set = new TreeSet(); set.add("BMW"); set.add("Toyota"); set.add("Ford"); return set; } Set buildTreeSetCarVendors2() { Set set = new TreeSet(); set.add("Mercedes"); set.add("Chevorlet"); set.add("BMW"); return set; } Set buildTreeSetWithNulls() { Set set = new TreeSet(); set.add("BMW"); //Note: Can not have nulls. Throws an exception. //set.add(null); set.add(""); return set; } }