Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.util.List;

public class Main {
    /**
     * Determines if all entries in a list are equal.
     * 
     * @param list
     *            the list to check equal objects.
     * @return true, if all objects are equal; false otherwise.
     */
    public static <T> boolean allEqual(List<T> list) {
        boolean allEqual = true;

        for (int i = 0; i < list.size(); i++) {
            if (!list.get(0).equals(list.get(i))) {
                allEqual = false;
                break;
            }
        }

        return allEqual;
    }
}