use of org.eclipse.collections.api.set.primitive.LongSet in project mapdb by jankotek.
the class AbstractMutableLongLongMapTestCase method freeze.
@Test
public void freeze() {
MutableLongLongMap mutableLongLongMap = this.classUnderTest();
LongSet frozenSet = mutableLongLongMap.keySet().freeze();
LongSet frozenSetCopy = LongHashSet.newSetWith(mutableLongLongMap.keySet().toArray());
Assert.assertEquals(frozenSet, frozenSetCopy);
Assert.assertEquals(frozenSetCopy, mutableLongLongMap.keySet().freeze());
for (int i = 0; i < 32; i++) {
mutableLongLongMap.put((long) i, (long) i);
Assert.assertEquals(frozenSet, frozenSetCopy);
}
LongSet frozenSetForRemove = mutableLongLongMap.keySet().freeze();
LongSet frozenSetCopyForRemove = LongHashSet.newSetWith(mutableLongLongMap.keySet().toArray());
Assert.assertEquals(frozenSetForRemove, frozenSetCopyForRemove);
Assert.assertEquals(frozenSetCopyForRemove, mutableLongLongMap.keySet().freeze());
for (int i = 0; i < 32; i++) {
mutableLongLongMap.remove((long) i);
Assert.assertEquals(frozenSetForRemove, frozenSetCopyForRemove);
}
MutableLongLongMap mutableLongLongMapForClear = this.classUnderTest();
LongSet frozenSetForClear = mutableLongLongMapForClear.keySet().freeze();
LongSet frozenSetCopyForClear = LongHashSet.newSetWith(mutableLongLongMapForClear.keySet().toArray());
mutableLongLongMapForClear.clear();
Assert.assertEquals(frozenSetForClear, frozenSetCopyForClear);
}
Aggregations