Java Collection Combine combine(Collection first, Collection second)

Here you can find the source of combine(Collection first, Collection second)

Description

combine

License

Open Source License

Declaration

public static <T> List<T> combine(Collection<? extends T> first, Collection<? extends T> second) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright (c) 2010-2011 Sonatype, Inc.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 *   http://www.eclipse.org/legal/epl-v10.html
 *******************************************************************************/

import java.util.ArrayList;
import java.util.Collection;

import java.util.List;

public class Main {
    public static <T> List<T> combine(Collection<? extends T> first, Collection<? extends T> second) {
        List<T> result = new ArrayList<T>(first.size() + second.size());
        result.addAll(first);//w  ww  .ja  v  a  2 s.c  om
        result.addAll(second);
        return result;
    }
}

Related

  1. combine(Collection... collections)
  2. combine(Collection strings)
  3. combine(final Collection[] c)
  4. combine(String separator, Collection parts)