/*
 * @author Ranides Atterwim <ranides@gmail.com>
 * @copyright Ranides Atterwim
 * @license WTFPL
 * @url http://ranides.net/projects/assira
 */
package net.ranides.assira.generic;

import java.util.Arrays;
import net.ranides.assira.collection.arrays.ArrayUtils;

public class Tuple implements Comparable<Tuple> {

    private final Object[] values;

    public Tuple(Object... values) {
        this.values = ArrayUtils.copy(values);
    }

    @Override
    public boolean equals(Object value) {
        return (value instanceof Tuple) && Arrays.equals(values, ((Tuple)value).values);
    }

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

    @Override
    public int compareTo(Tuple that) {
        return ArrayUtils.compare(this.values, that.values);
    }

}
