Guest User

Untitled

a guest
Oct 22nd, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. List<String> names = Arrays.asList("Alice", "Bob", "Charlie", "Dave");
  2. names
  3. .mapped(e -> { return e.length(); })
  4. .asIterable() // returns an Iterable of BiValue elements
  5. // an element's key is the person's name, its value is the string length
  6. .filter(e -> e.getValue() >= 4)
  7. .sorted((a, b) -> a.getValue() - b.getValue())
  8. .forEach(e -> { System.out.println(e.getKey() + '\t' + e.getValue()); });
Add Comment
Please, Sign In to add comment