List of usage examples for java.util NavigableSet headSet
SortedSet<E> headSet(E toElement);
Equivalent to headSet(toElement, false) .
From source file:com.google.gwt.emultest.java.util.TreeSetTest.java
/** * Test method for 'java.util.SortedSet.headSet(Object)' and * 'java.util.NavigableSet.headSet(Object, boolean)'. * * @see java.util.SortedSet#headSet(Object) * @see java.util.NavigableSet#headSet(Object, boolean) *//* ww w . java 2 s . c om*/ public void testHeadSet() { // test with no entries NavigableSet<E> set = createNavigableSet(); assertNotNull(set.headSet(getKeys()[0])); assertNotNull(set.headSet(getKeys()[0], false)); assertNotNull(set.headSet(getKeys()[0], true)); }
From source file:com.google.gwt.emultest.java.util.TreeSetTest.java
/** * Test method for 'java.util.SortedSet.headSet(Object)' and * 'java.util.NavigableSet.headSet(Object, boolean)'. * * @see java.util.SortedSet#headSet(Object) * @see java.util.NavigableSet#headSet(Object, boolean) *///from ww w . ja va 2s . c o m public void testHeadSet_entries0_size() { // test with no entries NavigableSet<E> set = createNavigableSet(); assertEquals(0, set.headSet(getKeys()[0]).size()); assertEquals(0, set.headSet(getKeys()[0], false).size()); assertEquals(0, set.headSet(getKeys()[0], true).size()); }
From source file:com.google.gwt.emultest.java.util.TreeSetTest.java
/** * Test method for 'java.util.SortedSet.headSet(Object)' and * 'java.util.NavigableSet.headSet(Object, boolean)'. * * @see java.util.SortedSet#headSet(Object) * @see java.util.NavigableSet#headSet(Object, boolean) *//*ww w . j av a 2 s. co m*/ public void testHeadSet_entries1() { NavigableSet<E> set = createNavigableSet(); // test with a single entry set set.add(getKeys()[0]); assertEquals(0, set.headSet(getKeys()[0]).size()); assertEquals(0, set.headSet(getKeys()[0], false).size()); assertEquals(1, set.headSet(getKeys()[0], true).size()); }
From source file:com.google.gwt.emultest.java.util.TreeSetTest.java
/** * Test method for 'java.util.SortedSet.headSet(Object)' and * 'java.util.NavigableSet.headSet(Object, boolean)'. * * @see java.util.SortedSet#headSet(Object) * @see java.util.NavigableSet#headSet(Object, boolean) *///from w ww.j a v a2 s .c o m public void testHeadSet_entries2() { NavigableSet<E> set = createNavigableSet(); // test with two entry set set.add(getKeys()[0]); set.add(getKeys()[1]); assertEquals(0, set.headSet(getKeys()[0]).size()); assertEquals(1, set.headSet(getKeys()[1]).size()); assertEquals(getKeys()[0], set.tailSet(getKeys()[0]).toArray()[0]); assertEquals(0, set.headSet(getKeys()[0], false).size()); assertEquals(1, set.headSet(getKeys()[1], false).size()); assertEquals(getKeys()[0], set.headSet(getKeys()[0], true).toArray()[0]); assertEquals(1, set.headSet(getKeys()[0], true).size()); assertEquals(2, set.headSet(getKeys()[1], true).size()); assertEquals(getKeys()[0], set.headSet(getKeys()[1], false).toArray()[0]); assertEquals(getKeys()[1], set.headSet(getKeys()[1], true).toArray()[1]); assertEquals(0, set.headSet(getKeys()[0], false).size()); assertEquals(getKeys()[1], set.headSet(getKeys()[1], true).toArray()[1]); }