package de.dhbwstuttgart.util;

import java.util.Objects;

public class Tuple<T1, T2> {
    protected final T1 first;
    protected final T2 second;

    public Tuple(T1 a, T2 b) {
        this.second = b;
        this.first = a;
    }

    public T1 getFirst() {
        return first;
    }

    public T2 getSecond() {
        return second;
    }

    public String toString() {
    	return "(" + first.toString() + "," + second.toString() + ")\n";
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Tuple<?, ?> pair = (Tuple<?, ?>) o;
        return Objects.equals(first, pair.first) && Objects.equals(second, pair.second);
    }

    @Override
    public int hashCode() {
        return Objects.hash(first, second);
    }
}
