Search in sources :

Example 41 with LongSet

use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.

the class LongOpenHashSetTest method add.

@Test
public void add() {
    LongSet longSet = PrimitiveSets.newLongOpenHashSet();
    longSet.add(0L);
    longSet.add(5L);
    longSet.add(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));
}
Also used : LongSet(com.b2international.collections.longs.LongSet) Test(org.junit.Test)

Example 42 with LongSet

use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.

the class LongOpenHashSetTest method toArray_empty.

@Test
public void toArray_empty() {
    LongSet longSet = PrimitiveSets.newLongOpenHashSet();
    long[] array = longSet.toArray();
    assertEquals("Array should be empty for empty sets.", 0, array.length);
}
Also used : LongSet(com.b2international.collections.longs.LongSet) Test(org.junit.Test)

Example 43 with LongSet

use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.

the class LongOpenHashSetTest method contains_false_after_remove.

@Test
public void contains_false_after_remove() {
    LongSet longSet = PrimitiveSets.newLongOpenHashSet();
    longSet.add(0L);
    longSet.add(5L);
    longSet.add(10L);
    longSet.remove(0L);
    longSet.remove(5L);
    longSet.remove(10L);
    assertEquals("Long set size should be 0.", 0, longSet.size());
    assertTrue("Long set should be empty.", longSet.isEmpty());
    assertFalse("Long set should not contain element 0.", longSet.contains(0L));
    assertFalse("Long set should not contain element 5.", longSet.contains(5L));
    assertFalse("Long set should not contain element 10.", longSet.contains(10L));
}
Also used : LongSet(com.b2international.collections.longs.LongSet) Test(org.junit.Test)

Example 44 with LongSet

use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.

the class LongOpenHashSetTest method create_collection.

@Test
public void create_collection() {
    LongSet longSet = PrimitiveSets.newLongOpenHashSet(PrimitiveLists.newLongArrayList(0L, 5L, 10L, 5L));
    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));
}
Also used : LongSet(com.b2international.collections.longs.LongSet) Test(org.junit.Test)

Example 45 with LongSet

use of com.b2international.collections.longs.LongSet in project snow-owl by b2ihealthcare.

the class LongOpenHashSetTest method create_empty_array.

@Test
public void create_empty_array() {
    LongSet longSet = PrimitiveSets.newLongOpenHashSet(new long[0]);
    assertTrue("Long set should be empty.", longSet.isEmpty());
}
Also used : LongSet(com.b2international.collections.longs.LongSet) Test(org.junit.Test)

Aggregations

LongSet (com.b2international.collections.longs.LongSet)63 Test (org.junit.Test)46 LongIterator (com.b2international.collections.longs.LongIterator)9 PrimitiveSets (com.b2international.collections.PrimitiveSets)3 LongList (com.b2international.collections.longs.LongList)3 Concepts (com.b2international.snowowl.snomed.common.SnomedConstants.Concepts)3 ImmutableList (com.google.common.collect.ImmutableList)3 Sets (com.google.common.collect.Sets)3 Collection (java.util.Collection)3 PrimitiveMaps (com.b2international.collections.PrimitiveMaps)2 IntIterator (com.b2international.collections.ints.IntIterator)2 LongKeyMap (com.b2international.collections.longs.LongKeyMap)2 LongSets (com.b2international.commons.collect.LongSets)2 CycleDetectedException (com.b2international.commons.exceptions.CycleDetectedException)2 RelationshipValue (com.b2international.snowowl.snomed.core.domain.RelationshipValue)2 ConcreteDomainFragment (com.b2international.snowowl.snomed.datastore.ConcreteDomainFragment)2 StatementFragment (com.b2international.snowowl.snomed.datastore.StatementFragment)2 StatementFragmentWithDestination (com.b2international.snowowl.snomed.datastore.StatementFragmentWithDestination)2 StatementFragmentWithValue (com.b2international.snowowl.snomed.datastore.StatementFragmentWithValue)2 List (java.util.List)2