Java Collection Add addItem(Collection collection, Object item)

Here you can find the source of addItem(Collection collection, Object item)

Description

add Item

License

Apache License

Declaration

@SuppressWarnings({ "unchecked", "rawtypes" })
    public static void addItem(Collection<?> collection, Object item) 

Method Source Code


//package com.java2s;
/*/*from w  w  w .ja v  a 2s. c  o  m*/
 * Copyright 2012 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

import java.util.Collection;

public class Main {
    @SuppressWarnings({ "unchecked", "rawtypes" })
    public static void addItem(Collection<?> collection, Object item) {
        ((Collection) collection).add(item);
    }
}

Related

  1. addIfNotNull(final Collection collection, final V value)
  2. addIgnoreNull(Collection collection, Object object)
  3. addIgnoreNull(Collection collection, T object)
  4. addIgnoreNull(final Collection collection, final T object)
  5. addInClauseToQuery(StringBuilder query, Collection l)
  6. addMatchingStrings(Collection availableProperties, String startWith, Collection strings)
  7. addNewLines(Collection strings)
  8. addNonNull(Object element, Collection result)
  9. addNonnullIfMissing(Collection collection, T element)

  10. HOME | Copyright © www.java2s.com 2016