use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.
the class LongOpenHashSetTest method toArray.
@Test
public void toArray() {
LongSet longSet = PrimitiveSets.newLongOpenHashSet();
longSet.add(0L);
longSet.add(5L);
longSet.add(10L);
long[] array = longSet.toArray();
Arrays.sort(array);
assertArrayEquals("Array should contain all stored elements.", new long[] { 0L, 5L, 10L }, array);
}
use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.
the class LongOpenHashSetTest method create_zero_size_fill_factor.
@Test
public void create_zero_size_fill_factor() {
LongSet longSet = PrimitiveSets.newLongOpenHashSetWithExpectedSize(0, 0.5d);
assertTrue("Long set should be empty.", longSet.isEmpty());
}
use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.
the class LongOpenHashSetTest method trimToSize.
@Test
public void trimToSize() {
LongSet longSet = PrimitiveSets.newLongOpenHashSet();
longSet.trimToSize();
}
use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.
the class LongOpenHashSetTest method iterator_overrun.
@Test(expected = NoSuchElementException.class)
public void iterator_overrun() {
LongSet longSet = PrimitiveSets.newLongOpenHashSet();
LongIterator itr = longSet.iterator();
itr.next();
}
use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.
the class LongTarjanTest method smallBatchSize.
@Test
public void smallBatchSize() throws Exception {
final LongKeyLongMap followerMap = PrimitiveMaps.newLongKeyLongOpenHashMap();
followerMap.put(1, 2);
followerMap.put(2, 3);
followerMap.put(3, 4);
followerMap.put(4, 1);
followerMap.put(5, 3);
followerMap.put(6, 2);
followerMap.put(7, 8);
followerMap.put(8, 6);
final LongTarjan tarjan = new LongTarjan(3, currentId -> LongCollections.singletonSet(followerMap.get(currentId)));
final List<LongSet> actual = tarjan.run(followerMap.keySet());
assertEquals(ImmutableList.of(PrimitiveSets.newLongOpenHashSet(1L, 2L, 3L, 4L), PrimitiveSets.newLongOpenHashSet(5L, 6L, 8L), PrimitiveSets.newLongOpenHashSet(7L)), actual);
}
Aggregations