Java Collection Add addCheck(Collection c, Object o)

Here you can find the source of addCheck(Collection c, Object o)

Description

add Check

License

Open Source License

Declaration

@SuppressWarnings("unchecked")
    private static void addCheck(Collection c, Object o) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 *  Copyright (c) 2012 Google, Inc./* w ww. ja v  a2  s .c om*/
 *  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
 *  
 *  Contributors:
 *  Google, Inc. - initial API and implementation
 *******************************************************************************/

import java.util.Collection;

public class Main {
    @SuppressWarnings("unchecked")
    private static void addCheck(Collection dest, Collection src) {
        /* add object to collection if non-null */
        if (src.size() > 0) {
            // Iterator iter = src.iterator();
            // while (iter.hasNext()) {
            // dest.addAll(getWidgets((Widget)iter.next()));
            // }
            dest.addAll(src);
        }
    }

    @SuppressWarnings("unchecked")
    private static void addCheck(Collection c, Object o) {
        /* add object to collection if non-null */
        if (o != null) {
            c.add(o);
            // c.addAll(getWidgets((Widget)o));
        }
    }
}

Related

  1. addAllUnique(final Collection collection, final Collection values)
  2. addArray(Collection col, T[] array)
  3. addArray(java.util.Collection v, T array[])
  4. addArrayToCollection(T[] array, Collection collection)
  5. addArrayToCollection(T[] array, Collection collection)
  6. addCollections(Collection... inCollections)
  7. addCondition(Collection conditions, String condition, double value)
  8. addConditionImpl(Collection conditions, String condition, String value)
  9. addDirToStringPaths(Collection ss, String dir)