Пример #1
0
 /** ************************ TEST MUTATION ******************************************* */
 @Test
 public void testOversizedMiddleInsert() {
   TreeSet<Integer> canon = new TreeSet<>();
   for (int i = 0; i < 10000000; i++) canon.add(i);
   Object[] btree =
       BTree.build(Arrays.asList(Integer.MIN_VALUE, Integer.MAX_VALUE), UpdateFunction.noOp());
   btree = BTree.update(btree, naturalOrder(), canon, UpdateFunction.<Integer>noOp());
   canon.add(Integer.MIN_VALUE);
   canon.add(Integer.MAX_VALUE);
   assertTrue(BTree.isWellFormed(btree, naturalOrder()));
   testEqual("Oversize", BTree.iterator(btree), canon.iterator());
 }
Пример #2
0
 public static <V extends Comparable<V>> BTreeSet<V> of(V value) {
   return new BTreeSet<>(
       BTree.build(ImmutableList.of(value), UpdateFunction.<V>noOp()), Ordering.<V>natural());
 }
Пример #3
0
 public static <V> BTreeSet<V> of(Comparator<? super V> comparator, V value) {
   return new BTreeSet<>(
       BTree.build(ImmutableList.of(value), UpdateFunction.<V>noOp()), comparator);
 }
Пример #4
0
 public static <V extends Comparable<V>> BTreeSet<V> of(Collection<V> sortedValues) {
   return new BTreeSet<>(
       BTree.build(sortedValues, UpdateFunction.<V>noOp()), Ordering.<V>natural());
 }