Shivang Agarwalさん:
私は、ストリームのフィルタ条件を満たすために失敗したオブジェクトを処理しようとしています。
List<Integer> list = Arrays.asList(1,23,43,12,4,5);
list.stream().filter( i -> i > 10).collect(Collections.toList);
これは、10よりも大きいオブジェクトのリストを返しますが、私はまた、条件(> 10)を満たすことができないオブジェクトを処理したいです。
ありがとうございました。
ユージン:
Map<Boolean, List<Integer>> map = list.stream()
.collect(Collectors.partitioningBy(i > 10));
map.get(false/true).... do whatever you want with those that failed or not