cz.cuni.mff.ms.brodecva.botnicek.ide.utils.data.Comparisons.java Source code

Java tutorial

Introduction

Here is the source code for cz.cuni.mff.ms.brodecva.botnicek.ide.utils.data.Comparisons.java

Source

/**
 * Copyright Vclav Brodec 2014.
 * 
 * This file is part of Botn?ek.
 * 
 * Botn?ek is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Botn?ek 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 General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Botn?ek.  If not, see <http://www.gnu.org/licenses/>.
 */
package cz.cuni.mff.ms.brodecva.botnicek.ide.utils.data;

import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;

/**
 * Pomocn metody porovnvn objekt.
 * 
 * @author Vclav Brodec
 * @version 1.0
 */
public final class Comparisons {

    /**
     * Zjist, zda-li jsou prvky navzjem rzn.
     * 
     * @param elements
     *            prvky
     * @return zda-li jsou vechny prvky navzjem rzn
     */
    @SafeVarargs
    public static <E> boolean allDifferent(final E... elements) {
        Preconditions.checkNotNull(elements);

        return ImmutableSet.copyOf(elements).size() == elements.length;
    }

}