package com.github.bot.curiosone.core.util;

import java.util.Objects;

/**
 * Provides utility methods to easily create and manage an immutable tuple of Objects.
 */
public class Pair<F, S> {

  /**
   * Stores the first element of the pair.
   */
  private final F first;

  /**
   * Stores the second element of the pair.
   */
  private final S second;

  /**
   * Constructs this Pair.
   * @param first the first object in the pair
   * @param second the second object in the pair
   */
  public Pair(F first, S second) {
    this.first = first;
    this.second = second;
  }

  /**
   * Gets the first element of the pair.
   */
  public F getFirst() {
    return first;
  }

  /**
   * Gets the second element of the pair.
   */
  public S getSecond() {
    return second;
  }

  /**
   * Checks the two objects for equality by delegating to their respective
   * {@link Object#equals(Object)} methods.
   * @param other the {@link Pair} to be compared against
   * @return {@code true} if the underlying objects of the Pair are both equal;
             {@code false} otherwise.
   */
  @Override
  public boolean equals(Object other) {
    if (other == this) {
      return true;
    }
    if (other == null || other.getClass() != this.getClass()) {
      return false;
    }
    Pair<?, ?> that = (Pair<?, ?>) other;
    return Objects.equals(that.first, this.first) && Objects.equals(that.second, this.second);
  }

  /**
   * Returns the HashCode for this Pair.
   * The HashCode is based on the HashCode of each element.
   */
  @Override
  public int hashCode() {
    return Objects.hash(first, second);
  }

  /**
   * Returns a String representation of this pair in the form (first, second).
   */
  @Override
  public String toString() {
    return "(" + first + ", " + second + ")";
  }

  /**
   * Utility method to create a new immutable Pair.
   * @param a the first Object of the new immutable Pair
   * @param b the second Object of the new immutable Pair
   * @return the new immutable Pair
   */
  public static <A, B> Pair<A, B> create(A a, B b) {
    return new Pair<A, B>(a, b);
  }
}

@@ -220,35 +220,36 @@
 st element of th
-e p
+is P
 air.%0A   */%0A  pri
@@ -303,35 +303,36 @@
 nd element of th
-e p
+is P
 air.%0A   */%0A  pri
@@ -398,21 +398,35 @@
  @param 
+ 
 first
+%0A   *        
  the fir
@@ -432,35 +432,36 @@
 rst object in th
-e p
+is P
 air%0A   * @param 
@@ -460,22 +460,36 @@
  @param 
+ 
 second
+%0A   *        
  the sec
@@ -504,19 +504,20 @@
 ct in th
-e p
+is P
 air%0A   *
@@ -615,28 +615,32 @@
 %0A  /**%0A   * 
-Gets
+@return 
  the first e
@@ -643,35 +643,36 @@
 st element of th
-e p
+is P
 air.%0A   */%0A  pub
@@ -728,12 +728,16 @@
   * 
-Gets
+@return 
  the
@@ -761,11 +761,12 @@
 f th
-e p
+is P
 air.
@@ -843,59 +843,159 @@
 cks 
+whe
 the
+r
  t
-wo objects for equality by delegating t
+his Pair equals to the given Object or not.%0A   * The equality comparison is performed on the two Objects contained in the Pairs, s
 o their
+%0A   *
  res
@@ -1001,21 +1001,16 @@
 spective
-%0A   *
  %7B@link 
@@ -1039,16 +1039,27 @@
  methods
+ are called
 .%0A   * @
@@ -1064,21 +1064,35 @@
  @param 
+ 
 other
+%0A   *        
  the %7B@l
@@ -1137,16 +1137,17 @@
 @return 
+ 
 %7B@code t
@@ -1162,20 +1162,9 @@
 the 
-underlying o
+O
 bjec
@@ -1194,16 +1194,17 @@
  equal;%0A
+ 
         
@@ -1584,22 +1584,25 @@
 **%0A   * 
-Return
+Calculate
 s the Ha
@@ -1683,16 +1683,56 @@
 lement.%0A
+   * @return  the HashCode of this Pair%0A
    */%0A  
@@ -1827,15 +1827,16 @@
   * 
-R
+@r
 eturn
-s
+ 
  a S
@@ -1864,17 +1864,17 @@
 of this 
-p
+P
 air in t
@@ -2066,17 +2066,31 @@
  @param 
-a
+ a%0A   *        
  the fir
@@ -2137,17 +2137,31 @@
  @param 
+ 
 b
+%0A   *        
  the sec
@@ -2210,16 +2210,17 @@
 @return 
+ 
 the new 

improve Pair javadoc