use of org.eclipse.collections.impl.list.mutable.primitive.ByteArrayList in project eclipse-collections by eclipse.
the class ImmutableEmptySortedBagTest method collectByte_target.
@Override
@Test
public void collectByte_target() {
ImmutableSortedBag<Integer> bag = this.classUnderTest();
Assert.assertEquals(new ByteArrayList(), bag.collectByte(PrimitiveFunctions.unboxIntegerToByte(), new ByteArrayList()));
ImmutableSortedBag<Integer> bag2 = this.classUnderTest();
Assert.assertEquals(new ByteHashBag(), bag2.collectByte(PrimitiveFunctions.unboxIntegerToByte(), new ByteHashBag()));
}
use of org.eclipse.collections.impl.list.mutable.primitive.ByteArrayList in project eclipse-collections by eclipse.
the class ImmutableByteByteMapKeySetTest method generateCollisions.
protected static ByteArrayList generateCollisions() {
ByteArrayList collisions = new ByteArrayList();
ImmutableByteByteMapKeySet set = (ImmutableByteByteMapKeySet) new ByteByteHashMap().keySet().freeze();
for (byte i = 2; collisions.size() <= 10; i++) {
if (set.spreadAndMask(i) == set.spreadAndMask((byte) 2)) {
collisions.add(i);
}
}
return collisions;
}
use of org.eclipse.collections.impl.list.mutable.primitive.ByteArrayList in project narchy by automenta.
the class Subterms method equivalentStructures.
// TODO optionally allow atomic structure positions to differ
default boolean equivalentStructures() {
int t0Struct = sub(0).structure();
int s = subs();
for (int i = 1; i < s; i++) {
if (sub(i).structure() != t0Struct)
return false;
}
ByteList structureKey = sub(0).structureKey();
ByteArrayList reuseKey = new ByteArrayList(structureKey.size());
for (int i = 1; i < s; i++) {
// TODO only needs to construct the key while comparing equality with the first
if (!sub(i).structureKey(reuseKey).equals(structureKey))
return false;
reuseKey.clear();
}
return true;
}
use of org.eclipse.collections.impl.list.mutable.primitive.ByteArrayList in project eclipse-collections by eclipse.
the class AbstractImmutableSortedMap method collectByte.
@Override
public ImmutableByteList collectByte(ByteFunction<? super V> byteFunction) {
ByteArrayList result = new ByteArrayList(this.size());
this.forEach(new CollectByteProcedure<>(byteFunction, result));
return result.toImmutable();
}
use of org.eclipse.collections.impl.list.mutable.primitive.ByteArrayList in project eclipse-collections by eclipse.
the class AbstractImmutableSortedSet method collectByte.
@Override
public ImmutableByteList collectByte(ByteFunction<? super T> byteFunction) {
ByteArrayList result = new ByteArrayList(this.size());
this.forEach(new CollectByteProcedure<>(byteFunction, result));
return result.toImmutable();
}
Aggregations