Created
August 2, 2018 16:54
-
-
Save StFS/65cd3524590be75bd356662f3de9bee8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<String> toollist = // a list of tool ids | |
Set<String, String> mapToolId = // a map convert ids to fully qualified names | |
Set<String> fqToolList = toollist.stream() | |
.peek( n -> { if (!mapToolId.containsKey(n.trim())) logger.warn("Ignoring unexpected tool id value '{}'", n); }) | |
.filter( n -> mapToolId.containsKey(n.trim()) ) | |
.map( n -> mapToolId.get(n.trim())) // map shorthand tool names to fully qualified tool names | |
.collect( Collectors.toCollection(HashSet::new) ); // make sure we have a mutable set |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hvað með þetta? Jújú, það er heilt nýtt fall hérna, en þú getur fært það einhvert annað í filtera-safn eða hvað sem þú myndir vilja gera. Gerir .filter() aðeins betra