All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cdc.util.tuples.CTupleN Maven / Gradle / Ivy

package cdc.util.tuples;

/**
 * Tuple of N comparable values, all with the same type.
 *
 * @author Damien Carbonne
 *
 * @param  Value type.
 */
public class CTupleN> extends TupleN implements CTuple> {
    @SafeVarargs
    public CTupleN(T... values) {
        super(values);
    }

    @Override
    public int compareTo(CTupleN o) {
        final int min = Math.min(size(), o.size());
        for (int index = 0; index < min; index++) {
            final int cmp = getValue(index).compareTo(o.getValue(index));
            if (cmp != 0) {
                return cmp;
            }
        }
        return size() - o.size();
    }

    @Override
    public boolean equals(Object other) {
        return super.equals(other);
    }

    @Override
    public int hashCode() {
        return super.hashCode();
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy