Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.*;

public class Main {
    public static void assertAllDifferent(Object... entities) {
        assertAllDifferent(Arrays.asList(entities));
    }

    public static void assertAllDifferent(List<?> entities) {

        Set<?> set = new LinkedHashSet<>(entities);

        if (set.size() != entities.size()) {
            throw new IllegalArgumentException("All entities must be different: " + entities + ", " + set);
        }

    }
}