Java List Contain containsInEach(List first, List second)

Here you can find the source of containsInEach(List first, List second)

Description

Contains in each.

License

Open Source License

Parameter

Parameter Description
first the first
second the second

Return

true, if successful

Declaration

public static boolean containsInEach(List<String> first, List<String> second) 

Method Source Code

//package com.java2s;
/*/*from  w w w .java2  s.co m*/
 * CollectionUtil.java
 * Copyright (c) 2014, CODEROAD, All Rights Reserved.
 *
 * This software is the confidential and proprietary information of CODEROAD
 * ("Confidential Information"). You shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement you entered into with
 * CODEROAD.
 */

import java.util.List;

public class Main {
    /**
     * Contains in each.
     * 
     * @param first the first
     * @param second the second
     * @return true, if successful
     */
    public static boolean containsInEach(List<String> first, List<String> second) {
        for (String value : second) {
            if (!first.contains(value)) {
                return false;
            }
        }
        return true;
    }
}

Related

  1. containsIgnoreCase(List list, String s)
  2. containsIgnoreCase(List list, String soughtFor)
  3. containsIgnoreCase(String str, String... list)
  4. containsInAnyOrder(final List test, final List control)
  5. containsIndex(int index, List objects)
  6. ContainsInList(String list, String value)
  7. containsInOrder(List a, List b)
  8. containsInstance(final List list, final Class clazz)
  9. containsInstance(List list, Object object)