Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Arrays;
import java.util.List;

import java.util.function.Function;

import java.util.stream.Collectors;

public class Main {
    static public <E> String mkString(List<E> list, Function<E, String> stringify, String delimiter) {
        return list.stream().map(stringify).collect(Collectors.joining(delimiter));
    }

    static public String mkString(String[] arr, String delimiter) {
        return mkString(Arrays.asList(arr), (String x) -> x, delimiter);
    }
}