Search in sources :

Example 86 with NavigableSet

use of java.util.NavigableSet in project mapdb by jankotek.

the class TreeSubSetTest method testSubSetContents2.

public void testSubSetContents2() {
    NavigableSet set = set5();
    SortedSet sm = set.subSet(two, three);
    assertEquals(1, sm.size());
    assertEquals(two, sm.first());
    assertEquals(two, sm.last());
    assertFalse(sm.contains(one));
    assertTrue(sm.contains(two));
    assertFalse(sm.contains(three));
    assertFalse(sm.contains(four));
    assertFalse(sm.contains(five));
    Iterator i = sm.iterator();
    Object k;
    k = (Integer) (i.next());
    assertEquals(two, k);
    assertFalse(i.hasNext());
    Iterator j = sm.iterator();
    j.next();
    j.remove();
    assertFalse(set.contains(two));
    assertEquals(4, set.size());
    assertEquals(0, sm.size());
    assertTrue(sm.isEmpty());
    assertFalse(sm.remove(three));
    assertEquals(4, set.size());
}
Also used : NavigableSet(java.util.NavigableSet) Iterator(java.util.Iterator) SortedSet(java.util.SortedSet)

Example 87 with NavigableSet

use of java.util.NavigableSet in project mapdb by jankotek.

the class TreeSubSetTest method testToString.

/**
     * toString contains toStrings of elements
     */
public void testToString() {
    NavigableSet q = populatedSet(SIZE);
    String s = q.toString();
    for (int i = 0; i < SIZE; ++i) {
        assertTrue(s.contains(String.valueOf(i)));
    }
}
Also used : NavigableSet(java.util.NavigableSet)

Example 88 with NavigableSet

use of java.util.NavigableSet in project mapdb by jankotek.

the class TreeSubSetTest method testDescendingCeiling.

/**
     * ceiling returns next element
     */
public void testDescendingCeiling() {
    NavigableSet q = dset5();
    Object e1 = q.ceiling(m3);
    assertEquals(m3, e1);
    Object e2 = q.ceiling(zero);
    assertEquals(m1, e2);
    Object e3 = q.ceiling(m5);
    assertEquals(m5, e3);
    Object e4 = q.ceiling(m6);
    assertNull(e4);
}
Also used : NavigableSet(java.util.NavigableSet)

Example 89 with NavigableSet

use of java.util.NavigableSet in project mapdb by jankotek.

the class TreeSubSetTest method testDescendingAddAll2.

/**
     * addAll of a collection with null elements throws NPE
     */
public void testDescendingAddAll2() {
    NavigableSet q = dset0();
    Integer[] ints = new Integer[SIZE];
    try {
        q.addAll(Arrays.asList(ints));
        shouldThrow();
    } catch (NullPointerException success) {
    }
}
Also used : NavigableSet(java.util.NavigableSet)

Example 90 with NavigableSet

use of java.util.NavigableSet in project mapdb by jankotek.

the class TreeSubSetTest method testLower.

/**
     * lower returns preceding element
     */
public void testLower() {
    NavigableSet q = set5();
    Object e1 = q.lower(three);
    assertEquals(two, e1);
    Object e2 = q.lower(six);
    assertEquals(five, e2);
    Object e3 = q.lower(one);
    assertNull(e3);
    Object e4 = q.lower(zero);
    assertNull(e4);
}
Also used : NavigableSet(java.util.NavigableSet)

Aggregations

NavigableSet (java.util.NavigableSet)197 Iterator (java.util.Iterator)36 SortedSet (java.util.SortedSet)26 Map (java.util.Map)12 TreeSet (java.util.TreeSet)11 HashMap (java.util.HashMap)7 Set (java.util.Set)6 TimeRange (org.apache.hadoop.hbase.io.TimeRange)6 List (java.util.List)5 TestSuite (junit.framework.TestSuite)5 Scan (org.apache.hadoop.hbase.client.Scan)5 Test (org.testng.annotations.Test)5 ArrayList (java.util.ArrayList)4 TreeMap (java.util.TreeMap)4 HashSet (java.util.HashSet)3 Get (org.apache.hadoop.hbase.client.Get)3 GwtIncompatible (com.google.common.annotations.GwtIncompatible)2 TestStringSetGenerator (com.google.common.collect.testing.TestStringSetGenerator)2 TestStringSortedSetGenerator (com.google.common.collect.testing.TestStringSortedSetGenerator)2 ByteString (com.google.protobuf.ByteString)2