Java Collection Contain containsNone(Collection container, Collection other)

Here you can find the source of containsNone(Collection container, Collection other)

Description

contains None

License

Apache License

Declaration

public static <T> boolean containsNone(Collection<T> container, Collection<T> other) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 * Copyright 2009, 2010 Lars Grammel //  w  w w . ja  va 2 s . c  om
 *
 * 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 {
    public static <T> boolean containsNone(Collection<T> container, Collection<T> other) {

        assert container != null;
        assert other != null;

        for (T t : other) {
            if (container.contains(t)) {
                return false;
            }
        }

        return true;
    }
}

Related

  1. containsInstance(Collection collection, Object element)
  2. containsInstance(Collection collection, Object element)
  3. containsInstanceOf(Collection collection, Class c)
  4. containsKey(Collection keys, String key)
  5. containsNo(Collection baseList, Collection valueList)
  6. containsNoNull(final Collection c, final String s)
  7. containsNoNulls(Collection container)
  8. containsNull(Collection collection)
  9. containsNull(Collection args)

    HOME | Copyright © www.java2s.com 2016