Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- List<String> names = Arrays.asList("Alice", "Bob", "Charlie", "Dave");
- names
- .mapped(e -> { return e.length(); })
- .asIterable() // returns an Iterable of BiValue elements
- // an element's key is the person's name, its value is the string length
- .filter(e -> e.getValue() >= 4)
- .sorted((a, b) -> a.getValue() - b.getValue())
- .forEach(e -> { System.out.println(e.getKey() + '\t' + e.getValue()); });
Add Comment
Please, Sign In to add comment