SubtagSet implements Serializable, Cloneable, Iterable<Subtag>,
		Comparable<SubtagSet> { public Subtag get(int index) { if (index < 0 || index >= count()) throw new IndexOutOfBoundsException(); Subtag tag = primary; for (int n = 1; n <= index; n++) tag = tag.getNext(); return tag; } 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 testGet() { Subtag lang = new Subtag(Language.EN); Subtag region = new Subtag(Region.US); lang.setNext(region); ConcreteSubtagSet set = new ConcreteSubtagSet(lang); assertEquals(lang, set.get(0)); assertEquals(region, set.get(1)); try { set.get(-1); fail("Expected exception"); } catch (Exception e) { } try { set.get(2); fail("Expected exception"); } catch (Exception e) { } }