use of org.eclipse.collections.impl.bag.mutable.primitive.CharHashBag in project eclipse-collections by eclipse.
the class CharAdapter method toBag.
@Override
public MutableCharBag toBag() {
int size = this.size();
CharHashBag bag = new CharHashBag(size);
for (int i = 0; i < size; i++) {
bag.add(this.get(i));
}
return bag;
}
use of org.eclipse.collections.impl.bag.mutable.primitive.CharHashBag in project eclipse-collections by eclipse.
the class AbstractMutableMap method collectChar.
@Override
public MutableCharBag collectChar(CharFunction<? super V> charFunction) {
MutableCharBag result = new CharHashBag();
this.forEach(new CollectCharProcedure<>(charFunction, result));
return result;
}
use of org.eclipse.collections.impl.bag.mutable.primitive.CharHashBag in project eclipse-collections by eclipse.
the class AbstractRichIterableTestCase method collectCharWithBagTarget.
@Test
public void collectCharWithBagTarget() {
CharHashBag target = new CharHashBag();
CharHashBag result = this.newWith(1, 2, 3, 4).collectChar(PrimitiveFunctions.unboxIntegerToChar(), target);
Assert.assertSame("Target list sent as parameter not returned", target, result);
Assert.assertEquals(CharHashBag.newBagWith((char) 1, (char) 2, (char) 3, (char) 4), result);
}
use of org.eclipse.collections.impl.bag.mutable.primitive.CharHashBag in project eclipse-collections by eclipse.
the class MapIterateTest method collectCharWithTarget.
@Test
public void collectCharWithTarget() {
CharHashBag target = new CharHashBag();
CharHashBag result = MapIterate.collectChar(MapIterateTest.newLittleMap(), PrimitiveFunctions.unboxIntegerToChar(), target);
Assert.assertEquals(CharHashBag.newBagWith((char) 1, (char) 2), result.toBag());
Assert.assertSame("Target sent as parameter was not returned as result", target, result);
}
use of org.eclipse.collections.impl.bag.mutable.primitive.CharHashBag in project eclipse-collections by eclipse.
the class RichIterableTestCase method RichIterable_iterationOrder.
@Test
default void RichIterable_iterationOrder() {
MutableCollection<Integer> expectedIterationOrder = this.expectedIterationOrder();
Procedure<Object> noop = each -> {
};
MutableCollection<Integer> selectIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().select(selectIterationOrder::add).forEach(noop);
assertEquals(expectedIterationOrder, selectIterationOrder);
MutableCollection<Integer> selectTargetIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().select(selectTargetIterationOrder::add, new HashBag<>());
assertEquals(expectedIterationOrder, selectTargetIterationOrder);
MutableCollection<Integer> selectWithIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().selectWith((each, param) -> selectWithIterationOrder.add(each), null).forEach(noop);
assertEquals(expectedIterationOrder, selectWithIterationOrder);
MutableCollection<Integer> selectWithTargetIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().selectWith((each, param) -> selectWithTargetIterationOrder.add(each), null, new HashBag<>());
assertEquals(expectedIterationOrder, selectWithTargetIterationOrder);
MutableCollection<Integer> rejectIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().reject(rejectIterationOrder::add).forEach(noop);
assertEquals(expectedIterationOrder, rejectIterationOrder);
MutableCollection<Integer> rejectTargetIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().reject(rejectTargetIterationOrder::add, new HashBag<>());
assertEquals(expectedIterationOrder, rejectTargetIterationOrder);
MutableCollection<Integer> rejectWithIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().rejectWith((each, param) -> rejectWithIterationOrder.add(each), null).forEach(noop);
assertEquals(expectedIterationOrder, rejectWithIterationOrder);
MutableCollection<Integer> rejectWithTargetIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().rejectWith((each, param) -> rejectWithTargetIterationOrder.add(each), null, new HashBag<>());
assertEquals(expectedIterationOrder, rejectWithTargetIterationOrder);
MutableCollection<Integer> partitionIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().partition(partitionIterationOrder::add);
assertEquals(expectedIterationOrder, partitionIterationOrder);
MutableCollection<Integer> partitionWithIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().partitionWith((each, param) -> partitionWithIterationOrder.add(each), null);
assertEquals(expectedIterationOrder, partitionWithIterationOrder);
MutableCollection<Integer> collectIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collect(collectIterationOrder::add).forEach(noop);
assertEquals(expectedIterationOrder, collectIterationOrder);
MutableCollection<Integer> collectTargetIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collect(collectTargetIterationOrder::add, new HashBag<>());
assertEquals(expectedIterationOrder, collectTargetIterationOrder);
MutableCollection<Integer> collectWithIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collectWith((each, param) -> collectWithIterationOrder.add(each), null).forEach(noop);
assertEquals(expectedIterationOrder, collectWithIterationOrder);
MutableCollection<Integer> collectWithTargetIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collectWith((each, param) -> collectWithTargetIterationOrder.add(each), null, new HashBag<>());
assertEquals(expectedIterationOrder, collectWithTargetIterationOrder);
MutableCollection<Integer> collectIfPredicateIterationOrder = this.newMutableForFilter();
MutableCollection<Integer> collectIfFunctionIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collectIf(collectIfPredicateIterationOrder::add, collectIfFunctionIterationOrder::add).forEach(noop);
assertEquals(expectedIterationOrder, collectIfPredicateIterationOrder);
assertEquals(expectedIterationOrder, collectIfFunctionIterationOrder);
MutableCollection<Integer> collectIfPredicateTargetIterationOrder = this.newMutableForFilter();
MutableCollection<Integer> collectIfFunctionTargetIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collectIf(collectIfPredicateTargetIterationOrder::add, collectIfFunctionTargetIterationOrder::add, new HashBag<>());
assertEquals(expectedIterationOrder, collectIfPredicateTargetIterationOrder);
assertEquals(expectedIterationOrder, collectIfFunctionTargetIterationOrder);
MutableCollection<Integer> collectBooleanIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collectBoolean(collectBooleanIterationOrder::add).forEach(each -> {
});
assertEquals(expectedIterationOrder, collectBooleanIterationOrder);
MutableCollection<Integer> collectBooleanTargetIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collectBoolean(collectBooleanTargetIterationOrder::add, new BooleanHashBag());
assertEquals(expectedIterationOrder, collectBooleanTargetIterationOrder);
MutableCollection<Integer> collectByteIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collectByte((Integer each) -> {
collectByteIterationOrder.add(each);
return (byte) 0;
}).forEach(each -> {
});
assertEquals(expectedIterationOrder, collectByteIterationOrder);
MutableCollection<Integer> collectByteTargetIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collectByte((Integer each) -> {
collectByteTargetIterationOrder.add(each);
return (byte) 0;
}, new ByteHashBag());
assertEquals(expectedIterationOrder, collectByteTargetIterationOrder);
MutableCollection<Integer> collectCharIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collectChar((Integer each) -> {
collectCharIterationOrder.add(each);
return ' ';
}).forEach(each -> {
});
assertEquals(expectedIterationOrder, collectCharIterationOrder);
MutableCollection<Integer> collectCharTargetIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collectChar((Integer each) -> {
collectCharTargetIterationOrder.add(each);
return ' ';
}, new CharHashBag());
assertEquals(expectedIterationOrder, collectCharTargetIterationOrder);
MutableCollection<Integer> collectDoubleIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collectDouble((Integer each) -> {
collectDoubleIterationOrder.add(each);
return 0.0;
}).forEach(each -> {
});
assertEquals(expectedIterationOrder, collectDoubleIterationOrder);
MutableCollection<Integer> collectDoubleTargetIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collectDouble((Integer each) -> {
collectDoubleTargetIterationOrder.add(each);
return 0.0;
}, new DoubleHashBag());
assertEquals(expectedIterationOrder, collectDoubleTargetIterationOrder);
MutableCollection<Integer> collectFloatIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collectFloat((Integer each) -> {
collectFloatIterationOrder.add(each);
return 0.0f;
}).forEach(each -> {
});
assertEquals(expectedIterationOrder, collectFloatIterationOrder);
MutableCollection<Integer> collectFloatTargetIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collectFloat((Integer each) -> {
collectFloatTargetIterationOrder.add(each);
return 0.0f;
}, new FloatHashBag());
assertEquals(expectedIterationOrder, collectFloatTargetIterationOrder);
MutableCollection<Integer> collectIntIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collectInt((Integer each) -> {
collectIntIterationOrder.add(each);
return 0;
}).forEach(each -> {
});
assertEquals(expectedIterationOrder, collectIntIterationOrder);
MutableCollection<Integer> collectIntTargetIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collectInt((Integer each) -> {
collectIntTargetIterationOrder.add(each);
return 0;
}, new IntHashBag());
assertEquals(expectedIterationOrder, collectIntTargetIterationOrder);
MutableCollection<Integer> collectLongIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collectLong((Integer each) -> {
collectLongIterationOrder.add(each);
return 0L;
}).forEach(each -> {
});
assertEquals(expectedIterationOrder, collectLongIterationOrder);
MutableCollection<Integer> collectLongTargetIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collectLong((Integer each) -> {
collectLongTargetIterationOrder.add(each);
return 0L;
}, new LongHashBag());
assertEquals(expectedIterationOrder, collectLongTargetIterationOrder);
MutableCollection<Integer> collectShortIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collectShort((ShortFunction<Integer>) each -> {
collectShortIterationOrder.add(each);
return (short) 0;
}).forEach(each -> {
});
assertEquals(expectedIterationOrder, collectShortIterationOrder);
MutableCollection<Integer> collectShortTargetIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().collectShort((ShortFunction<Integer>) each -> {
collectShortTargetIterationOrder.add(each);
return (short) 0;
}, new ShortHashBag());
assertEquals(expectedIterationOrder, collectShortTargetIterationOrder);
MutableCollection<Integer> flatCollectIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().flatCollect(each -> Lists.immutable.with(flatCollectIterationOrder.add(each))).forEach(noop);
assertEquals(expectedIterationOrder, flatCollectIterationOrder);
MutableCollection<Integer> flatCollectTargetIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().flatCollect(each -> Lists.immutable.with(flatCollectTargetIterationOrder.add(each)), new HashBag<>());
assertEquals(expectedIterationOrder, flatCollectTargetIterationOrder);
MutableCollection<Integer> countIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().count(countIterationOrder::add);
assertEquals(expectedIterationOrder, countIterationOrder);
MutableCollection<Integer> countWithIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().countWith((each, param) -> countWithIterationOrder.add(each), null);
assertEquals(expectedIterationOrder, countWithIterationOrder);
MutableCollection<Integer> anySatisfyIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().anySatisfy(each -> {
anySatisfyIterationOrder.add(each);
return false;
});
assertEquals(expectedIterationOrder, anySatisfyIterationOrder);
MutableCollection<Integer> anySatisfyWithIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().anySatisfyWith((each, param) -> {
anySatisfyWithIterationOrder.add(each);
return false;
}, null);
assertEquals(expectedIterationOrder, anySatisfyWithIterationOrder);
MutableCollection<Integer> allSatisfyIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().allSatisfy(each -> {
allSatisfyIterationOrder.add(each);
return true;
});
assertEquals(expectedIterationOrder, allSatisfyIterationOrder);
MutableCollection<Integer> allSatisfyWithIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().allSatisfyWith((each, param) -> {
allSatisfyWithIterationOrder.add(each);
return true;
}, null);
assertEquals(expectedIterationOrder, allSatisfyWithIterationOrder);
MutableCollection<Integer> noneSatisfyIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().noneSatisfy(each -> {
noneSatisfyIterationOrder.add(each);
return false;
});
assertEquals(expectedIterationOrder, noneSatisfyIterationOrder);
MutableCollection<Integer> noneSatisfyWithIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().noneSatisfyWith((each, param) -> {
noneSatisfyWithIterationOrder.add(each);
return false;
}, null);
assertEquals(expectedIterationOrder, noneSatisfyWithIterationOrder);
MutableCollection<Integer> detectIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().detect(each -> {
detectIterationOrder.add(each);
return false;
});
assertEquals(expectedIterationOrder, detectIterationOrder);
MutableCollection<Integer> detectWithIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().detectWith((each, param) -> {
detectWithIterationOrder.add(each);
return false;
}, null);
assertEquals(expectedIterationOrder, detectWithIterationOrder);
MutableCollection<Integer> detectIfNoneIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().detectIfNone(each -> {
detectIfNoneIterationOrder.add(each);
return false;
}, () -> 0);
assertEquals(expectedIterationOrder, detectIfNoneIterationOrder);
MutableCollection<Integer> detectWithIfNoneIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().detectWithIfNone((each, param) -> {
detectWithIfNoneIterationOrder.add(each);
return false;
}, null, () -> 0);
assertEquals(expectedIterationOrder, detectWithIfNoneIterationOrder);
MutableCollection<Integer> minComparatorIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().min((o1, o2) -> {
if (minComparatorIterationOrder.isEmpty()) {
minComparatorIterationOrder.add(o2);
}
minComparatorIterationOrder.add(o1);
return 0;
});
assertEquals(expectedIterationOrder, minComparatorIterationOrder);
MutableCollection<Integer> maxComparatorIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().max((o1, o2) -> {
if (maxComparatorIterationOrder.isEmpty()) {
maxComparatorIterationOrder.add(o2);
}
maxComparatorIterationOrder.add(o1);
return 0;
});
assertEquals(expectedIterationOrder, maxComparatorIterationOrder);
MutableCollection<Integer> minByIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().minBy(minByIterationOrder::add);
assertEquals(expectedIterationOrder, minByIterationOrder);
MutableCollection<Integer> maxByIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().maxBy(maxByIterationOrder::add);
assertEquals(expectedIterationOrder, maxByIterationOrder);
MutableCollection<Integer> groupByIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().groupBy(groupByIterationOrder::add);
assertEquals(expectedIterationOrder, groupByIterationOrder);
MutableCollection<Integer> groupByTargetIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().groupBy(groupByTargetIterationOrder::add, new HashBagMultimap<>());
assertEquals(expectedIterationOrder, groupByTargetIterationOrder);
MutableCollection<Integer> groupByEachIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().groupByEach(each -> {
groupByEachIterationOrder.add(each);
return Lists.immutable.with(each);
});
assertEquals(expectedIterationOrder, groupByEachIterationOrder);
MutableCollection<Integer> groupByEachTargetIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().groupByEach(each -> {
groupByEachTargetIterationOrder.add(each);
return Lists.immutable.with(each);
}, new HashBagMultimap<>());
assertEquals(expectedIterationOrder, groupByEachTargetIterationOrder);
MutableCollection<Integer> sumOfFloatIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().sumOfFloat(each -> {
sumOfFloatIterationOrder.add(each);
return each.floatValue();
});
assertEquals(expectedIterationOrder, sumOfFloatIterationOrder);
MutableCollection<Integer> sumOfDoubleIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().sumOfDouble(each -> {
sumOfDoubleIterationOrder.add(each);
return each.doubleValue();
});
assertEquals(expectedIterationOrder, sumOfDoubleIterationOrder);
MutableCollection<Integer> sumOfIntIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().sumOfInt(each -> {
sumOfIntIterationOrder.add(each);
return each.intValue();
});
assertEquals(expectedIterationOrder, sumOfIntIterationOrder);
MutableCollection<Integer> sumOfLongIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().sumOfLong(each -> {
sumOfLongIterationOrder.add(each);
return each.longValue();
});
assertEquals(expectedIterationOrder, sumOfLongIterationOrder);
/*
* TODO: Fix sumByPrimitive methods for bags, to only iterate once per item, not per occurrence.
MutableCollection<Integer> sumByDoubleIterationOrder1 = this.newMutableForFilter();
MutableCollection<Integer> sumByDoubleIterationOrder2 = this.newMutableForFilter();
this.getInstanceUnderTest().sumByDouble(
each -> {
sumByDoubleIterationOrder1.add(each);
return each;
},
each -> {
sumByDoubleIterationOrder2.add(each);
return 0.0;
});
assertEquals(expectedIterationOrder, sumByDoubleIterationOrder1);
assertEquals(expectedIterationOrder, sumByDoubleIterationOrder2);
MutableCollection<Integer> sumByFloatIterationOrder1 = this.newMutableForFilter();
MutableCollection<Integer> sumByFloatIterationOrder2 = this.newMutableForFilter();
this.getInstanceUnderTest().sumByFloat(
each -> {
sumByFloatIterationOrder1.add(each);
return each;
},
each -> {
sumByFloatIterationOrder2.add(each);
return 0.0f;
});
assertEquals(expectedIterationOrder, sumByFloatIterationOrder1);
assertEquals(expectedIterationOrder, sumByFloatIterationOrder2);
MutableCollection<Integer> sumByIntIterationOrder1 = this.newMutableForFilter();
MutableCollection<Integer> sumByIntIterationOrder2 = this.newMutableForFilter();
this.getInstanceUnderTest().sumByInt(
each -> {
sumByIntIterationOrder1.add(each);
return each;
},
each -> {
sumByIntIterationOrder2.add(each);
return 0;
});
assertEquals(expectedIterationOrder, sumByIntIterationOrder1);
assertEquals(expectedIterationOrder, sumByIntIterationOrder2);
MutableCollection<Integer> sumByLongIterationOrder1 = this.newMutableForFilter();
MutableCollection<Integer> sumByLongIterationOrder2 = this.newMutableForFilter();
this.getInstanceUnderTest().sumByLong(
each -> {
sumByLongIterationOrder1.add(each);
return each;
},
each -> {
sumByLongIterationOrder2.add(each);
return 0L;
});
assertEquals(expectedIterationOrder, sumByLongIterationOrder1);
assertEquals(expectedIterationOrder, sumByLongIterationOrder2);
*/
MutableCollection<Integer> expectedInjectIntoIterationOrder = this.allowsDuplicates() ? this.newMutableForFilter(4, 4, 4, 4, 3, 3, 3, 2, 2, 1) : expectedIterationOrder;
MutableCollection<Integer> injectIntoIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().injectInto(0, (Function2<Integer, Integer, Integer>) (argument1, argument2) -> {
injectIntoIterationOrder.add(argument2);
return argument1 + argument2;
});
assertEquals(expectedInjectIntoIterationOrder, injectIntoIterationOrder);
MutableCollection<Integer> injectIntoIntIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().injectInto(0, (IntObjectToIntFunction<Integer>) (intParameter, objectParameter) -> {
injectIntoIntIterationOrder.add(objectParameter);
return intParameter + objectParameter;
});
assertEquals(expectedInjectIntoIterationOrder, injectIntoIntIterationOrder);
MutableCollection<Integer> injectIntoLongIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().injectInto(0L, (LongObjectToLongFunction<Integer>) (longParameter, objectParameter) -> {
injectIntoLongIterationOrder.add(objectParameter);
return longParameter + objectParameter;
});
assertEquals(expectedInjectIntoIterationOrder, injectIntoLongIterationOrder);
MutableCollection<Integer> injectIntoDoubleIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().injectInto(0L, (DoubleObjectToDoubleFunction<Integer>) (doubleParameter, objectParameter) -> {
injectIntoDoubleIterationOrder.add(objectParameter);
return doubleParameter + objectParameter;
});
assertEquals(expectedInjectIntoIterationOrder, injectIntoDoubleIterationOrder);
MutableCollection<Integer> injectIntoFloatIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().injectInto(0L, (FloatObjectToFloatFunction<Integer>) (floatParameter, objectParameter) -> {
injectIntoFloatIterationOrder.add(objectParameter);
return floatParameter + objectParameter;
});
assertEquals(expectedInjectIntoIterationOrder, injectIntoFloatIterationOrder);
Counter toSortedListCount = new Counter();
this.getInstanceUnderTest().toSortedList((o1, o2) -> {
toSortedListCount.increment();
return 0;
});
assertEquals(expectedIterationOrder.size() - 1, toSortedListCount.getCount());
/*
MutableCollection<Integer> toSortedListByIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().toSortedListBy(toSortedListByIterationOrder::add);
assertEquals(expectedIterationOrder.size(), toSortedListByIterationOrder.size());
*/
Counter toSortedSetCount = new Counter();
this.getInstanceUnderTest().toSortedSet((o1, o2) -> {
toSortedSetCount.increment();
return 0;
});
assertEquals(expectedIterationOrder.size(), toSortedSetCount.getCount());
/*
MutableCollection<Integer> toSortedSetByIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().toSortedSetBy(toSortedSetByIterationOrder::add);
assertEquals(expectedIterationOrder.size(), toSortedSetByIterationOrder.size());
*/
Counter toSortedBagCount = new Counter();
this.getInstanceUnderTest().toSortedBag((o1, o2) -> {
toSortedBagCount.increment();
return 0;
});
assertEquals(expectedIterationOrder.size(), toSortedBagCount.getCount());
/*
MutableCollection<Integer> toSortedBagByIterationOrder = this.newMutableForFilter();
this.getInstanceUnderTest().toSortedBagBy(toSortedBagByIterationOrder::add);
assertEquals(expectedIterationOrder.size(), toSortedBagByIterationOrder.size());
*/
MutableCollection<Integer> summarizeIntOrder = this.newMutableForFilter();
this.getInstanceUnderTest().summarizeInt(each -> {
summarizeIntOrder.add(each);
return 0;
});
assertEquals(expectedIterationOrder, summarizeIntOrder);
MutableCollection<Integer> summarizeFloatOrder = this.newMutableForFilter();
this.getInstanceUnderTest().summarizeFloat(each -> {
summarizeFloatOrder.add(each);
return 0;
});
assertEquals(expectedIterationOrder, summarizeFloatOrder);
MutableCollection<Integer> summarizeLongOrder = this.newMutableForFilter();
this.getInstanceUnderTest().summarizeLong(each -> {
summarizeLongOrder.add(each);
return 0;
});
assertEquals(expectedIterationOrder, summarizeLongOrder);
MutableCollection<Integer> summarizeDoubleOrder = this.newMutableForFilter();
this.getInstanceUnderTest().summarizeDouble(each -> {
summarizeDoubleOrder.add(each);
return 0;
});
assertEquals(expectedIterationOrder, summarizeDoubleOrder);
}
Aggregations