I have a collection of objects that I would like to partition into two collections, one of which passes a predicate and one of which fails a predicate. I was hoping there wo
With the new java 8 features(stream and lambda epressions), you could write:
List words = Arrays.asList("foo", "bar", "hello", "world"); Map> partitionedMap = words.stream().collect( Collectors.partitioningBy(word -> word.length() > 3)); System.out.println(partitionedMap);