use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.
the class LongOpenHashSetTest method create.
@Test
public void create() {
LongSet longSet = PrimitiveSets.newLongOpenHashSet();
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 create_array.
@Test
public void create_array() {
LongSet longSet = PrimitiveSets.newLongOpenHashSet(0L, 5L, 10L);
assertEquals("Long set size should be 3.", 3, longSet.size());
assertTrue("Long set should contain element 0.", longSet.contains(0L));
assertTrue("Long set should contain element 5.", longSet.contains(5L));
assertTrue("Long set should contain element 10.", longSet.contains(10L));
}
use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.
the class LongOpenHashSetTest method create_empty_collection.
@Test
public void create_empty_collection() {
LongSet longSet = PrimitiveSets.newLongOpenHashSet(PrimitiveLists.newLongArrayList());
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 iterator.
@Test
public void iterator() {
LongSet longSet = PrimitiveSets.newLongOpenHashSet();
longSet.add(0L);
longSet.add(5L);
longSet.add(10L);
LongIterator itr = longSet.iterator();
long[] values = new long[3];
for (int i = 0; i < 3; i++) {
assertTrue("Iterator should indicate that the next value is available.", itr.hasNext());
values[i] = itr.next();
}
assertFalse("Iterator should indicate that there are no more elements.", itr.hasNext());
Arrays.sort(values);
assertEquals("Iterator should return first element.", 0L, values[0]);
assertEquals("Iterator should return second element.", 5L, values[1]);
assertEquals("Iterator should return third element.", 10L, values[2]);
}
use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.
the class LongOpenHashSetTest method removeAll_empty_set.
@Test
public void removeAll_empty_set() {
LongSet longSet = PrimitiveSets.newLongOpenHashSet();
LongSet otherSet = PrimitiveSets.newLongOpenHashSet();
longSet.add(0L);
longSet.add(5L);
longSet.add(10L);
longSet.removeAll(otherSet);
assertEquals("Long set size should be 3.", 3, longSet.size());
assertTrue("Long set should contain element 0.", longSet.contains(0L));
assertTrue("Long set should contain element 5.", longSet.contains(5L));
assertTrue("Long set should contain element 10.", longSet.contains(10L));
}
Aggregations