/** keySet.toArray returns contains all keys */
 public void testDescendingAscendingKeySetToArray() {
   ConcurrentNavigableMap map = dmap5();
   Set s = map.keySet();
   Object[] ar = s.toArray();
   assertTrue(s.containsAll(Arrays.asList(ar)));
   assertEquals(5, ar.length);
   ar[0] = m10;
   assertFalse(s.containsAll(Arrays.asList(ar)));
 }
 /** keySet returns a Set containing all the keys */
 public void testKeySet() {
   ConcurrentNavigableMap map = map5();
   Set s = map.keySet();
   assertEquals(5, s.size());
   assertTrue(s.contains(one));
   assertTrue(s.contains(two));
   assertTrue(s.contains(three));
   assertTrue(s.contains(four));
   assertTrue(s.contains(five));
 }
 /** keySet returns a Set containing all the keys */
 public void testDescendingKeySet() {
   ConcurrentNavigableMap map = dmap5();
   Set s = map.keySet();
   assertEquals(5, s.size());
   assertTrue(s.contains(m1));
   assertTrue(s.contains(m2));
   assertTrue(s.contains(m3));
   assertTrue(s.contains(m4));
   assertTrue(s.contains(m5));
 }
 /** keySet is ordered */
 public void testDescendingKeySetOrder() {
   ConcurrentNavigableMap map = dmap5();
   Set s = map.keySet();
   Iterator i = s.iterator();
   Integer last = (Integer) i.next();
   assertEquals(last, m1);
   while (i.hasNext()) {
     Integer k = (Integer) i.next();
     assertTrue(last.compareTo(k) > 0);
     last = k;
   }
 }
Пример #5
0
 private long estimatedSize() {
   long keySize = 0;
   for (PartitionPosition key : partitions.keySet()) {
     //  make sure we don't write non-sensical keys
     assert key instanceof DecoratedKey;
     keySize += ((DecoratedKey) key).getKey().remaining();
   }
   return (long)
       ((keySize // index entries
               + keySize // keys in data file
               + liveDataSize.get()) // data
           * 1.2); // bloom filter and row index overhead
 }