Search in sources :

Example 61 with NavigableSet

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

the class TreeSubSetTest method testToArray.

/**
     * toArray contains all elements in sorted order
     */
public void testToArray() {
    NavigableSet q = populatedSet(SIZE);
    Object[] o = q.toArray();
    for (int i = 0; i < o.length; i++) assertSame(o[i], q.pollFirst());
}
Also used : NavigableSet(java.util.NavigableSet)

Example 62 with NavigableSet

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

the class TreeSetTest method testSerialization.

/**
     * A deserialized serialized set has same elements
     */
public void testSerialization() throws Exception {
    NavigableSet x = populatedSet(SIZE);
    NavigableSet y = serialClone(x);
    assertNotSame(x, y);
    assertEquals(x.size(), y.size());
    assertEquals(x, y);
    assertEquals(y, x);
    while (!x.isEmpty()) {
        assertFalse(y.isEmpty());
        assertEquals(x.pollFirst(), y.pollFirst());
    }
    assertTrue(y.isEmpty());
}
Also used : NavigableSet(java.util.NavigableSet)

Example 63 with NavigableSet

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

the class TreeSubSetTest method testDescendingToString.

/**
     * toString contains toStrings of elements
     */
public void testDescendingToString() {
    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 64 with NavigableSet

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

the class TreeSubSetTest method testAddAll1.

/**
     * addAll(null) throws NPE
     */
public void testAddAll1() {
    NavigableSet q = set0();
    try {
        q.addAll(null);
        shouldThrow();
    } catch (NullPointerException success) {
    }
}
Also used : NavigableSet(java.util.NavigableSet)

Example 65 with NavigableSet

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

the class TreeSubSetTest method testPoll.

/**
     * poll succeeds unless empty
     */
public void testPoll() {
    NavigableSet q = populatedSet(SIZE);
    for (int i = 0; i < SIZE; ++i) {
        assertEquals(i, q.pollFirst());
    }
    assertNull(q.pollFirst());
}
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