Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.util.List;

public class Main {

    public static boolean equals(List x, List y) {
        if (x == y) {
            return true;
        }
        if (x.size() != y.size()) {
            return false;
        }
        int index = 0;
        for (int len = x.size(); index < len; index++) {
            Object valX = x.get(index);
            Object valY = y.get(index);
            if (!valX.equals(valY)) {
                return false;
            }
        }
        return true;
    }

    public static boolean equals(Object[] x, Object[] y) {
        if (x == y) {
            return true;
        }
        if (x.length != y.length) {
            return false;
        }
        int index = 0;
        for (int len = x.length; index < len; index++) {
            Object valX = x[index];
            Object valY = y[index];
            if (!valX.equals(valY)) {
                return false;
            }
        }
        return true;
    }

    public static boolean equals(int[] x, int[] y) {
        if (x == y) {
            return true;
        }
        if (x.length != y.length) {
            return false;
        }
        int index = 0;
        for (int len = x.length; index < len; index++) {
            int valX = x[index];
            int valY = y[index];
            if (valX != valY) {
                return false;
            }
        }
        return true;
    }
}