Saturday, June 3, 2017

String joining in Java 8


https://www.mkyong.com/java8/java-8-stringjoiner-example/

List<String> list = Arrays.asList("java", "python", "nodejs", "ruby");

//java | python | nodejs | ruby
String result = list.stream().map(x -> x).collect(Collectors.joining(" | "));

List<String> list = Arrays.asList("java", "python", "nodejs", "ruby");
  //java, python, nodejs, ruby
String result = String.join(", ", list);

2 comments:

Unknown said...

Very Impressive Spark tutorial. The content seems to be pretty exhaustive and excellent and will definitely help in learning Spark course. I'm also a learner taken up Spark trSparkning and I think your content has cleared some concepts of mine. While browsing for Spark tutorials on YouTube i found this fantastic video on Spark. Do check it out if you are interested to know more.
https://www.youtube.com/watch?v=o8Jy7ii4Uks

Unknown said...



Worthful Spark tutorial. Appreciate a lot for taking up the pSparkn to write such a quality content on Spark course. Just now I watched this similar Spark tutorial and I think this will enhance the knowledge of other visitors for sure. Thanks anyway.
https://www.youtube.com/watch?v=o8Jy7ii4Uks