/*
 * Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.apache.solr.common.util;

import java.io.Serializable;
import java.util.Objects;

public class Pair<T1, T2> implements Serializable {
  private final T1 first;
  private final T2 second;

  public T1 first() {
    return first;
  }

  public T2 second() {
    return second;
  }

  public Pair(T1 key, T2 value) {
    this.first = key;
    this.second = value;
  }

  @Override
  public boolean equals(Object obj) {
    if (obj instanceof Pair) {
      Pair that = (Pair) obj;
      return Objects.equals(this.first, that.first) && Objects.equals(this.second, that.second);
    }
    return false;
  }

  @Override
  public int hashCode() {
    return (this.first == null ? 0 : this.first.hashCode()) ^ (this.second == null ? 0 : this.second.hashCode());
  }
}
@@ -889,16 +889,136 @@
 jects;%0A%0A
+import static org.apache.solr.common.util.Utils.makeMap;%0Aimport static org.apache.solr.common.util.Utils.toJSONString;%0A%0A
 public c
@@ -1340,19 +1340,20 @@
 ect 
-obj
+that
 ) %7B%0A    
 if (
@@ -1352,15 +1352,19 @@
     
-if (obj
+return that
  ins
@@ -1379,54 +1379,19 @@
 Pair
-) %7B
+ &&
 %0A      
-Pair that = (Pair) obj;%0A      return
+ 
  Obj
@@ -1413,21 +1413,30 @@
 s.first,
+ ((Pair)
  that
+)
 .first) 
@@ -1437,16 +1437,24 @@
 irst) &&
+%0A       
  Objects
@@ -1473,21 +1473,30 @@
 .second,
+ ((Pair)
  that
+)
 .second)
@@ -1503,188 +1503,205 @@
 ;%0A  
-  %7D%0A    return false;%0A  %7D%0A%0A  @Override%0A  public int hashCode() %7B%0A    return (this.first == null ? 0 : this.first.hashCode()) %5E (this.second == null ? 0 : this.second.hashCode()
+%7D%0A%0A  @Override%0A  public String toString() %7B%0A    return toJSONString(makeMap(%22first%22, first, %22second%22, second));%0A  %7D%0A%0A  @Override%0A  public int hashCode() %7B%0A    return Objects.hash(first, second
 );%0A  %7D%0A
+%0A
 %7D

simplify hashcode() , equals() and implement toString()