use of org.eclipse.collections.impl.list.mutable.primitive.ShortArrayList in project eclipse-collections by eclipse.
the class ImmutableEmptySortedBagTest method collectShort.
@Override
@Test
public void collectShort() {
ImmutableSortedBag<Integer> bag = this.classUnderTest();
Assert.assertEquals(new ShortArrayList(), bag.collectShort(PrimitiveFunctions.unboxIntegerToShort()));
}
use of org.eclipse.collections.impl.list.mutable.primitive.ShortArrayList in project narchy by automenta.
the class Autoencoder method max.
public short[] max(float thresh) {
float[] y = this.y;
ShortArrayList s = null;
int outs = y.length;
for (int i = 0; i < outs; i++) {
float Y = y[i];
if (Y >= thresh) {
if (s == null)
s = new ShortArrayList(3);
s.add((short) i);
}
}
return (s == null) ? null : s.toArray();
}
use of org.eclipse.collections.impl.list.mutable.primitive.ShortArrayList in project narchy by automenta.
the class MyShortIntHashMap method filter.
public void filter(IntPredicate toKeep) {
int ss = size();
if (ss == 0)
return;
SentinelValues sv = this.sentinelValues;
if (sv != null && sv.containsZeroKey) {
if (!toKeep.accept(sv.zeroValue)) {
removeKey((short) 0);
// because it may have changed
sv = this.sentinelValues;
}
}
if (sv != null && sv.containsOneKey) {
if (!toKeep.accept(sv.oneValue)) {
removeKey((short) 1);
// because it may have changed
sv = this.sentinelValues;
}
}
ShortArrayList tmp = new ShortArrayList(ss / 2);
short[] keys = this.keys;
int sizeBefore = keys.length;
int[] values = this.values;
for (int i = 0; i < sizeBefore; ++i) {
short k = keys[i];
if (isNonSentinel(k) && !toKeep.accept(values[i])) {
tmp.add(k);
}
}
int s = tmp.size();
if (s > 0) {
tmp.forEach(this::removeKey);
}
}
use of org.eclipse.collections.impl.list.mutable.primitive.ShortArrayList in project eclipse-collections by eclipse.
the class AbstractImmutableSortedMap method collectShort.
@Override
public ImmutableShortList collectShort(ShortFunction<? super V> shortFunction) {
ShortArrayList result = new ShortArrayList(this.size());
this.forEach(new CollectShortProcedure<>(shortFunction, result));
return result.toImmutable();
}
use of org.eclipse.collections.impl.list.mutable.primitive.ShortArrayList in project eclipse-collections by eclipse.
the class AbstractMutableSortedMap method collectShort.
@Override
public MutableShortList collectShort(ShortFunction<? super V> shortFunction) {
ShortArrayList result = new ShortArrayList(this.size());
this.forEach(new CollectShortProcedure<>(shortFunction, result));
return result;
}
Aggregations