Search in sources :

Example 21 with NavigableSet

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

the class ConcurrentSkipListSubSetTest method testDescendingFloor.

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

Example 22 with NavigableSet

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

the class ConcurrentSkipListSubSetTest method testDescendingIteratorRemove.

/**
     * iterator.remove removes current element
     */
public void testDescendingIteratorRemove() {
    final NavigableSet q = dset0();
    q.add(new Integer(2));
    q.add(new Integer(1));
    q.add(new Integer(3));
    Iterator it = q.iterator();
    it.next();
    it.remove();
    it = q.iterator();
    assertEquals(it.next(), new Integer(2));
    assertEquals(it.next(), new Integer(3));
    assertFalse(it.hasNext());
}
Also used : NavigableSet(java.util.NavigableSet) Iterator(java.util.Iterator)

Example 23 with NavigableSet

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

the class ConcurrentSkipListSubSetTest method testCeiling.

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

Example 24 with NavigableSet

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

the class ConcurrentSkipListSubSetTest method testAddDup.

/**
     * Add of duplicate element fails
     */
public void testAddDup() {
    NavigableSet q = set0();
    assertTrue(q.add(six));
    assertFalse(q.add(six));
}
Also used : NavigableSet(java.util.NavigableSet)

Example 25 with NavigableSet

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

the class ConcurrentSkipListSubSetTest method testHeadSetContents.

/**
     * headSet returns set with keys in requested range
     */
public void testHeadSetContents() {
    NavigableSet set = set5();
    SortedSet sm = set.headSet(four);
    assertTrue(sm.contains(one));
    assertTrue(sm.contains(two));
    assertTrue(sm.contains(three));
    assertFalse(sm.contains(four));
    assertFalse(sm.contains(five));
    Iterator i = sm.iterator();
    Object k;
    k = (Integer) (i.next());
    assertEquals(one, k);
    k = (Integer) (i.next());
    assertEquals(two, k);
    k = (Integer) (i.next());
    assertEquals(three, k);
    assertFalse(i.hasNext());
    sm.clear();
    assertTrue(sm.isEmpty());
    assertEquals(2, set.size());
    assertEquals(four, set.first());
}
Also used : NavigableSet(java.util.NavigableSet) Iterator(java.util.Iterator) SortedSet(java.util.SortedSet)

Aggregations

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