Created
November 17, 2018 20:40
-
-
Save kijanowski/80e81f522ea0589b7649fce0e1548c73 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
| // instead of | |
| public String legacyJoin(String... args) { | |
| return java.util.Arrays | |
| .stream(args) | |
| .collect(Collectors.joining(", ")); | |
| } | |
| // do it the functional way | |
| public String vavrJoin(String... args) { | |
| return io.vavr.collection.List | |
| .of(args) | |
| .mkString(", "); | |
| } | |
| // or just be aware of what the JDK offers | |
| public String stringJavaJoiner(String... args) { | |
| return String.join(", ", args); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment