Java List Contain contains(int[] match, List container)

Here you can find the source of contains(int[] match, List container)

Description

Returns a flag indicating whether the container list contains an array which matches the specified match array.

License

Open Source License

Parameter

Parameter Description
match the array to match
container the list of arrays to test

Return

true if so, false if not

Declaration

public static boolean contains(int[] match, List<int[]> container) 

Method Source Code

//package com.java2s;
/* ---------------------------------------------------------------------
 * Numenta Platform for Intelligent Computing (NuPIC)
 * Copyright (C) 2014, Numenta, Inc.  Unless you have an agreement
 * with Numenta, Inc., for a separate license for this software code, the
 * following terms and conditions apply:
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero Public License version 3 as
 * published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Affero Public License for more details.
 *
 * You should have received a copy of the GNU Affero Public License
 * along with this program.  If not, see http://www.gnu.org/licenses.
 *
 * http://numenta.org/licenses///  w w  w . j a  va 2 s  .  c  o  m
 * ---------------------------------------------------------------------
 */

import java.util.Arrays;
import java.util.List;

public class Main {
    /**
     * Returns a flag indicating whether the container list contains an
     * array which matches the specified match array.
     *
     * @param match     the array to match
     * @param container the list of arrays to test
     * @return true if so, false if not
     */
    public static boolean contains(int[] match, List<int[]> container) {
        int len = container.size();
        for (int i = 0; i < len; i++) {
            if (Arrays.equals(match, container.get(i))) {
                return true;
            }
        }
        return false;
    }
}

Related

  1. contains(final List requested, final List claimed)
  2. contains(final List list, T value)
  3. contains(final String text, final List tokens)
  4. contains(final String[] list, final String value)
  5. contains(int[] list, int x)
  6. contains(int[] subject, int[][] list)
  7. contains(List aList, Object anObj)
  8. contains(List list, Object obj)
  9. contains(List lsttor, Object val)