package com.njust.test.java8;

import java.util.stream.Collectors;
import java.util.stream.Stream;

import org.junit.Test;

public class JoinTest
{
    @Test
    public void test()
    {
        String[] split = "1.2.3.4.5".split("\\.");
        String joinResult = Stream.of(split).collect(Collectors.joining("-"));
        System.out.println(joinResult);
        //1-2-3-4-5
    }
}

@@ -376,10 +376,494 @@
 5%0A    %7D%0A
+    %0A    @Test%0A    public void test2()%0A    %7B%0A        String%5B%5D split = %7B%22aa%22, %22bb%22, %22cc%22%7D;%0A        %0A        //java8%E4%B9%8B%E5%89%8D%0A        String sum = %22%22;%0A        for (String s : split)%0A        %7B%0A            sum = sum + s + %22-%22;%0A        %7D%0A        sum = sum.substring(0, sum.length() - 1);%0A        System.out.println(sum); //aa-bb-cc%0A        %0A        //java8%0A        String sum222 = Stream.of(split).collect(Collectors.joining(%22-%22)).toString();%0A        System.out.println(sum222); //aa-bb-cc%0A    %7D%0A
 %7D%0A

Update JoinTest.java