Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.Arrays;

import java.util.List;

public class Main {
    /**
     *Convenience method for checking if a list of arrays of objects contains a given array
     *Have to implement this because arrlist.contains uses .equals() to check equality
     *But this does only shallow checking. To check equality of arrays of objects, one should use
     *Arrays.deepEquals
     * */
    public static boolean deepContainsArray(List<? extends Object[]> list, Object[] oarr) {
        for (Object[] objarr : list) {
            if (Arrays.deepEquals(objarr, oarr)) {
                return true;
            }
        }

        return false;

    }
}