Java Collection Contain contains(Collection mainCollection, String str)

Here you can find the source of contains(Collection mainCollection, String str)

Description

contains

License

Open Source License

Declaration

public static boolean contains(Collection<String> mainCollection, String str) 

Method Source Code

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

import java.util.Collection;

public class Main {
    public static boolean contains(Collection<String> mainCollection, String str) {
        String[] mainArr = new String[mainCollection.size()];
        return contains(mainCollection.toArray(mainArr), str);
    }// www. ja  va2 s. com

    public static boolean contains(Collection<String> mainCollection, Collection<String> subCollection) {
        String[] mainArr = new String[mainCollection.size()];
        String[] subArr = new String[subCollection.size()];
        return contains(mainCollection.toArray(mainArr), subCollection.toArray(subArr));
    }

    public static boolean contains(String[] mainArr, String[] subArr) {
        for (String s : subArr) {
            if (!contains(mainArr, s)) {
                return false;
            }
        }
        return true;
    }

    public static boolean contains(String[] strArr, String str) {
        for (String s : strArr) {
            if (s.equals(str)) {
                return true;
            }
        }
        return false;
    }
}

Related

  1. contains(Collection searchIn, Object[] find)
  2. contains(Collection stringCollection, String value)
  3. contains(Collection collection, A value)
  4. contains(Collection objectArray, Object element)
  5. contains(Collection container, String strSearch)
  6. contains(Collection c1, Collection c2)
  7. contains(Collection collection, T item)
  8. contains(final Collection mimeTypes, final MimeType mimeType)
  9. contains(final Collection c, final T o)

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