From 5218116a80abba1bfee47875ef7221ba8d18b154 Mon Sep 17 00:00:00 2001 From: pivovarit Date: Sat, 11 Feb 2017 18:40:14 +0100 Subject: [PATCH] Reformat JoinerSplitter --- .../baeldung/streamApi/JoinerSplitter.java | 56 ++++++++++--------- 1 file changed, 30 insertions(+), 26 deletions(-) diff --git a/core-java/src/main/java/com/baeldung/streamApi/JoinerSplitter.java b/core-java/src/main/java/com/baeldung/streamApi/JoinerSplitter.java index 10bee06f1e..52ffc61799 100644 --- a/core-java/src/main/java/com/baeldung/streamApi/JoinerSplitter.java +++ b/core-java/src/main/java/com/baeldung/streamApi/JoinerSplitter.java @@ -7,30 +7,34 @@ import java.util.stream.Stream; public class JoinerSplitter { - public static String join ( String[] arrayOfString ) { - return Arrays.asList(arrayOfString) - .stream() - .map(x -> x) - .collect(Collectors.joining(",")); - } - - public static String joinWithPrefixPostFix ( String[] arrayOfString ) { - return Arrays.asList(arrayOfString) - .stream() - .map(x -> x) - .collect(Collectors.joining(",","[","]")); - } - - public static List split ( String str ) { - return Stream.of(str.split(",")) - .map (elem -> new String(elem)) - .collect(Collectors.toList()); - } - - public static List splitToListOfChar ( String str ) { - return str.chars() - .mapToObj(item -> (char) item) - .collect(Collectors.toList()); - } - + public static String join(String[] arrayOfString) { + return Arrays + .asList(arrayOfString) + .stream() + .map(x -> x) + .collect(Collectors.joining(",")); + } + + public static String joinWithPrefixPostFix(String[] arrayOfString) { + return Arrays + .asList(arrayOfString) + .stream() + .map(x -> x) + .collect(Collectors.joining(",", "[", "]")); + } + + public static List split(String str) { + return Stream + .of(str.split(",")) + .map(elem -> new String(elem)) + .collect(Collectors.toList()); + } + + public static List splitToListOfChar(String str) { + return str + .chars() + .mapToObj(item -> (char) item) + .collect(Collectors.toList()); + } + }