SubtagSet implements Serializable, Cloneable, Iterable<Subtag>,
		Comparable<SubtagSet> { public int compareTo(SubtagSet o) { Iterator<Subtag> i = iterator(); Iterator<Subtag> e = o.iterator(); for (; i.hasNext() && e.hasNext();) { Subtag inext = i.next(); Subtag enext = e.next(); int c = inext.compareTo(enext); if (c != 0) return c; } if (e.hasNext() && !i.hasNext()) return -1; if (i.hasNext() && !e.hasNext()) return 1; return 0; } protected  SubtagSet(Subtag primary); String toString(); Iterator<Subtag> iterator(); boolean contains(Subtag subtag); boolean contains(String tag); boolean contains(String tag, Subtag.Type type); int length(); boolean isValid(); @SuppressWarnings("unused") int count(); Subtag get(int index); int hashCode(); boolean equals(Object obj); Subtag[] toArray(); List<Subtag> asList(); int compareTo(SubtagSet o);  }
@Test public void testCompareTo() { Subtag lang1 = new Subtag(Language.EN); Subtag region1 = new Subtag(Region.US); lang1.setNext(region1); ConcreteSubtagSet set1 = new ConcreteSubtagSet(lang1); Subtag lang2 = new Subtag(Language.EN); Subtag region2 = new Subtag(Region.US); lang2.setNext(region2); ConcreteSubtagSet set2 = new ConcreteSubtagSet(lang2); Subtag lang3 = new Subtag(Language.DE); Subtag region3 = new Subtag(Region.DE); lang3.setNext(region3); ConcreteSubtagSet set3 = new ConcreteSubtagSet(lang3); Subtag lang4 = new Subtag(Language.EN); Subtag region4 = new Subtag(Region.US); Subtag script4 = new Subtag(Script.LATN); lang4.setNext(region4); region4.setNext(script4); ConcreteSubtagSet set4 = new ConcreteSubtagSet(lang4); assertTrue(0 == set1.compareTo(set1)); assertTrue(0 == set1.compareTo(set2)); assertFalse(set1.compareTo(set3) == 0); assertFalse(set1.compareTo(set4) == 0); assertFalse(set4.compareTo(set1) == 0); }