package de.dhbwstuttgart.util;

import java.util.Objects;
import java.util.Optional;

public class Pair<T, T1> extends Tuple<T, T1> {

  public Pair(T a, T1 b) {
    super(a, b);
  }

  public Optional<T1> getValue() {
    return Optional.of(second);
  }

  public T getKey() {
    return first;
  }

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

}
