// CSE 143, Winter 2009, Marty Stepp // This program tests whether HtmlTags are Comparable by seeing whether a // TreeSet (which requires its elements to be of a Comparable type) can // successfully store and sort a set of HtmlTag objects. import java.util.*; // for Set public class HtmlTagTest { public static void main(String[] args) { // first test for short valid code // hellohow are you
Set tags = new TreeSet(); tags.add(new HtmlTag("html", true)); // tags.add(new HtmlTag("body", true)); // tags.add(new HtmlTag("b", true)); // tags.add(new HtmlTag("b", false)); // tags.add(new HtmlTag("i", true)); // tags.add(new HtmlTag("b", true)); // tags.add(new HtmlTag("b", false)); // tags.add(new HtmlTag("br")); //
tags.add(new HtmlTag("i", false)); //
tags.add(new HtmlTag("body", false)); // tags.add(new HtmlTag("html", false)); // System.out.println(tags); } }