Java Collection Merge merge(Collection splits)

Here you can find the source of merge(Collection splits)

Description

merge

License

Open Source License

Declaration

public static <T, C extends Collection<T>> List<T> merge(Collection<C> splits) 

Method Source Code


//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();
        }// w  w w . j  av  a  2  s.c  o m
        List<T> list = new ArrayList<>();
        for (Collection<T> split : splits) {
            list.addAll(split);
        }
        return list;
    }
}

Related

  1. getMergedString(Collection values, String delimiter)
  2. merge(CC target, Collection a, Collection b)
  3. merge(Collection dest, Collection src)
  4. merge(Collection strings, char separator)
  5. merge(Collection... collections)
  6. merge(Collection... collections)
  7. merge(Collection... elems)