Java Stream Join join(Stream stream)

Here you can find the source of join(Stream stream)

Description

join

License

Apache License

Declaration

public final static <T> String join(Stream<T> stream) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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

public class Main {
    public final static <T> String join(Stream<T> stream) {
        return stream.map(t -> t.toString()).collect(Collectors.joining());
    }/*from   ww  w.  jav a  2  s.c  o  m*/

    public final static <T> String join(Stream<T> stream, String sep) {
        return stream.map(t -> t.toString()).collect(Collectors.joining(sep));
    }

    public final static <T> String join(Stream<T> stream, String sep, String start, String end) {
        return stream.map(t -> t.toString()).collect(Collectors.joining(sep, start, end));
    }
}

Related

  1. join(final String delimiter, final Stream stream)
  2. join(Stream vals)
  3. joinStringsAsArguments(Stream arguments)