use of com.annimon.stream.function.IntFunction in project Lightweight-Stream-API by aNNiMON.
the class FilterTest method testFilterWithMap.
@Test
public void testFilterWithMap() {
final List<Integer> items = Arrays.asList(0, 1, 2, 3, 4);
IntStream.range(0, items.size()).filter(new IntPredicate() {
@Override
public boolean test(int value) {
return items.get(value) % 2 == 0;
}
}).mapToObj(new IntFunction<String>() {
@Override
public String apply(int value) {
return Integer.toString(value);
}
}).custom(StreamMatcher.assertElements(contains("0", "2", "4")));
}
Aggregations