use of org.eclipse.collections.impl.math.IntegerSum in project eclipse-collections by eclipse.
the class IterateTest method injectIntoWith.
@Test
public void injectIntoWith() {
Sum result = new IntegerSum(0);
Integer parameter = 2;
MutableList<Integer> integers = Interval.oneTo(5).toList();
this.basicTestDoubleSum(result, integers, parameter);
}
use of org.eclipse.collections.impl.math.IntegerSum in project eclipse-collections by eclipse.
the class IterateTest method forEachWith.
@Test
public void forEachWith() {
this.iterables.each(each -> {
Sum result = new IntegerSum(0);
Iterate.forEachWith(each, (integer, parm) -> result.add(integer.intValue() * parm.intValue()), 2);
Assert.assertEquals(30, result.getValue().intValue());
});
}
use of org.eclipse.collections.impl.math.IntegerSum in project eclipse-collections by eclipse.
the class IterateTest method injectIntoWithHashSet.
@Test
public void injectIntoWithHashSet() {
Sum result = new IntegerSum(0);
Integer parameter = 2;
MutableSet<Integer> integers = Interval.toSet(1, 5);
this.basicTestDoubleSum(result, integers, parameter);
}
use of org.eclipse.collections.impl.math.IntegerSum in project eclipse-collections by eclipse.
the class LazyIterateTest method selectForEachWith.
@Test
public void selectForEachWith() {
LazyIterable<Integer> select = LazyIterate.select(Interval.oneTo(5), Predicates.lessThan(5));
Sum sum = new IntegerSum(0);
select.forEachWith((each, aSum) -> aSum.add(each), sum);
Assert.assertEquals(10, sum.getValue().intValue());
}
use of org.eclipse.collections.impl.math.IntegerSum in project eclipse-collections by eclipse.
the class LazyIterateTest method rejectForEachWith.
@Test
public void rejectForEachWith() {
LazyIterable<Integer> select = LazyIterate.reject(Interval.oneTo(5), Predicates.lessThan(5));
Sum sum = new IntegerSum(0);
select.forEachWith((each, aSum) -> aSum.add(each), sum);
Assert.assertEquals(5, sum.getValue().intValue());
}
Aggregations