Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;

import java.util.List;

public class Main {

    public static <T, C extends Collection<T>> List<T> merge(Collection<C> splits) {
        if (splits == null || splits.isEmpty()) {
            return Collections.emptyList();
        }
        List<T> list = new ArrayList<>();
        for (Collection<T> split : splits) {
            list.addAll(split);
        }
        return list;
    }
}