// http://www.programcreek.com/2013/01/sort-linkedlist-of-user-defined-objects-in-java/
import java.util.Collections;
import java.util.LinkedList;
public class HouseTester {
    public static void main(String[] args) {
        LinkedList<House> houseList = new LinkedList<>();
        houseList.add(new House("medium", 200));
        houseList.add(new House("small", 100));
        houseList.add(new House("large", 300));
        System.out.println("A list of houses: " + houseList);
        // sort in ascending order
        System.out.println("The list sorted:");
        Collections.sort(houseList);
        System.out.println(houseList);
        // sort in descending order
        System.out.println("The list sorted in reverse order:");
        Collections.sort(houseList, Collections.reverseOrder());
        System.out.println(houseList);
        House h = new House("nice house", 200);
        System.out.println("A house that is not on the list: " + h);
        if (houseList.contains(h)) {
            System.out.println("\"" + h + "\""
                    + " has the same size that one of the houses on the list.");
        }
    }
}
