/*
 * 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.samza.operators;


/**
 * A key and value pair.
 *
 * @param <K> type of the key
 * @param <V> type of the value
 */
public final class KV<K, V> {
  public final K key;
  public final V value;

  public static <K, V> KV<K, V> of(K key, V value) {
    return new KV<>(key, value);
  }

  public KV(K key, V value) {
    this.key = key;
    this.value = value;
  }

  public K getKey() {
    return key;
  }

  public V getValue() {
    return value;
  }
}

@@ -838,16 +838,111 @@
 ators;%0A%0A
+import com.google.common.base.MoreObjects;%0Aimport java.util.Arrays;%0Aimport java.util.Objects;%0A%0A
 %0A/**%0A * 
@@ -1367,11 +1367,661 @@
 lue;%0A  %7D
+%0A%0A  @Override%0A  public boolean equals(Object other) %7B%0A    if (this == other) %7B%0A      return true;%0A    %7D%0A    if (!(other instanceof KV)) %7B%0A      return false;%0A    %7D%0A    KV%3C?, ?%3E otherKv = (KV%3C?, ?%3E) other;%0A    // deepEquals is used here for arrays. This impl comes from Beam.%0A    return Objects.deepEquals(this.key, otherKv.key)%0A        && Objects.deepEquals(this.value, otherKv.value);%0A  %7D%0A%0A  @Override%0A  public int hashCode() %7B%0A    return Arrays.deepHashCode(new Object%5B%5D %7Bkey, value%7D);%0A  %7D%0A%0A  @Override%0A  public String toString() %7B%0A    return MoreObjects.toStringHelper(this)%0A        .addValue(key)%0A        .addValue(value)%0A        .toString();%0A  %7D
 %0A%7D%0A

Add equals, hashcode and toString to KV (#1138)