Here you can find the source of addTo(E element, C collection)
Parameter | Description |
---|---|
element | the element to add |
collection | the collection to add to |
public static <C extends Collection<E>, E> C addTo(E element, C collection)
//package com.java2s; /******************************************************************************* * Copyright (c) 2014 Red Hat, Inc. /*from www. jav a 2 s . c o m*/ * Distributed under license by Red Hat, Inc. All rights reserved. * This program is 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 * * Contributors: * Red Hat, Inc. - initial API and implementation ******************************************************************************/ import java.util.Collection; public class Main { /** * Adds the given element to the given collection. * * @param element the element to add * @param collection the collection to add to * @return */ public static <C extends Collection<E>, E> C addTo(E element, C collection) { collection.add(element); return collection; } }