Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;

import java.util.List;

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

public class Main {
    /**
     * Joins 2 collections into one list.
     *
     * @param a Some collection
     * @param b Some other collection
     * @param <T> The type of the elements
     *
     * @return A List that contains all the elements of both collections.
     */
    public static <T> List<T> join(Collection<? extends T> a, Collection<? extends T> b) {
        return Stream.concat(a.stream(), b.stream()).collect(Collectors.toList());
    }
}