Search in sources :

Example 41 with NavigableMap

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

the class TreeSubMapTest method testSize.

/**
     * size returns the correct values
     */
public void testSize() {
    NavigableMap map = map5();
    NavigableMap empty = map0();
    assertEquals(0, empty.size());
    assertEquals(5, map.size());
}
Also used : NavigableMap(java.util.NavigableMap)

Example 42 with NavigableMap

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

the class TreeSubMapTest method testDescendingPut1_NullPointerException.

/**
     * put(null,x) throws NPE
     */
public void testDescendingPut1_NullPointerException() {
    NavigableMap c = dmap5();
    try {
        c.put(null, "whatever");
        shouldThrow();
    } catch (NullPointerException success) {
    }
}
Also used : NavigableMap(java.util.NavigableMap)

Example 43 with NavigableMap

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

the class TreeMapTest method testHeadMapContents.

/**
     * headMap returns map with keys in requested range
     */
public void testHeadMapContents() {
    TreeMap map = map5();
    NavigableMap sm = map.headMap(four, false);
    assertTrue(sm.containsKey(one));
    assertTrue(sm.containsKey(two));
    assertTrue(sm.containsKey(three));
    assertFalse(sm.containsKey(four));
    assertFalse(sm.containsKey(five));
    Iterator i = sm.keySet().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, map.size());
    assertEquals(four, map.firstKey());
}
Also used : NavigableMap(java.util.NavigableMap) Iterator(java.util.Iterator) TreeMap(java.util.TreeMap)

Example 44 with NavigableMap

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

the class TreeSubMapTest method testDescendingHigherEntry.

/**
     * higherEntry returns next entry.
     */
public void testDescendingHigherEntry() {
    NavigableMap map = dmap5();
    Map.Entry e1 = map.higherEntry(m3);
    assertEquals(m4, e1.getKey());
    Map.Entry e2 = map.higherEntry(zero);
    assertEquals(m1, e2.getKey());
    Map.Entry e3 = map.higherEntry(m5);
    assertNull(e3);
    Map.Entry e4 = map.higherEntry(m6);
    assertNull(e4);
}
Also used : NavigableMap(java.util.NavigableMap) TreeMap(java.util.TreeMap) Map(java.util.Map) NavigableMap(java.util.NavigableMap) SortedMap(java.util.SortedMap)

Example 45 with NavigableMap

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

the class TreeSubMapTest method testPutAll.

/**
     * putAll adds all key-value pairs from the given map
     */
public void testPutAll() {
    NavigableMap empty = map0();
    NavigableMap map = map5();
    empty.putAll(map);
    assertEquals(5, empty.size());
    assertTrue(empty.containsKey(one));
    assertTrue(empty.containsKey(two));
    assertTrue(empty.containsKey(three));
    assertTrue(empty.containsKey(four));
    assertTrue(empty.containsKey(five));
}
Also used : NavigableMap(java.util.NavigableMap)

Aggregations

NavigableMap (java.util.NavigableMap)173 Map (java.util.Map)85 TreeMap (java.util.TreeMap)62 SortedMap (java.util.SortedMap)35 ArrayList (java.util.ArrayList)34 List (java.util.List)27 HashMap (java.util.HashMap)21 Iterator (java.util.Iterator)21 Cell (org.apache.hadoop.hbase.Cell)20 Result (org.apache.hadoop.hbase.client.Result)19 Set (java.util.Set)14 Get (org.apache.hadoop.hbase.client.Get)14 IOException (java.io.IOException)12 KeyValue (org.apache.hadoop.hbase.KeyValue)11 Test (org.junit.Test)11 Put (org.apache.hadoop.hbase.client.Put)10 Entry (java.util.Map.Entry)9 Update (co.cask.cdap.data2.dataset2.lib.table.Update)7 ImmutableMap (com.google.common.collect.ImmutableMap)7 TestSuite (junit.framework.TestSuite)7