Java Collection Contain contains(final Collection c, final T o)

Here you can find the source of contains(final Collection c, final T o)

Description

contains

License

Open Source License

Declaration

public static <T> boolean contains(final Collection<T> c, final T o) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.Collection;

public class Main {
    public static <T> boolean contains(final Collection<T> c, final T o) {
        return (c != null && c.contains(o));
    }//from ww w.j a  va  2  s .c o  m

    public static boolean contains(final String[] haystack, final String needle) {
        if (haystack != null && haystack.length != 0) {
            for (String straw : haystack) {
                if (needle.equals(straw)) {
                    return true;
                }
            }

            return false;
        } else {
            return false;
        }
    }
}

Related

  1. contains(Collection container, String strSearch)
  2. contains(Collection mainCollection, String str)
  3. contains(Collection c1, Collection c2)
  4. contains(Collection collection, T item)
  5. contains(final Collection mimeTypes, final MimeType mimeType)
  6. contains(Object o, Collection c)
  7. containsAll(Collection c, Iterable subset)
  8. containsAll(Collection coll, Collection other)
  9. containsAll(Collection collectionToCheck, Collection items)