package com.airlock.iam.base.misc.collection;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;

public final class Pair<A, B> {
   private final A first;
   private final B second;

   public static <A, B> Pair<A, B> pair(A first, B second) {
      return new Pair<>(first, second);
   }

   private Pair(A first, B second) {
      this.first = first;
      this.second = second;
   }

   public A getFirst() {
      return this.first;
   }

   public B getSecond() {
      return this.second;
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public String toString() {
      return "Pair(first=" + this.getFirst() + ", second=" + this.getSecond() + ")";
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public boolean equals(Object o) {
      if (o == this) {
         return true;
      } else if (!(o instanceof Pair<?, ?> other)) {
         return false;
      } else {
         Object this$first = this.first;
         Object other$first = other.first;
         if (this$first == null ? other$first == null : this$first.equals(other$first)) {
            Object this$second = this.second;
            Object other$second = other.second;
            return this$second == null ? other$second == null : this$second.equals(other$second);
         } else {
            return false;
         }
      }
   }

   @SuppressFBWarnings(justification = "generated code")
   @Override
   public int hashCode() {
      int PRIME = 59;
      int result = 1;
      Object $first = this.first;
      result = result * 59 + ($first == null ? 43 : $first.hashCode());
      Object $second = this.second;
      return result * 59 + ($second == null ? 43 : $second.hashCode());
   }
}
