org.organicdesign.fp.collections.KeyVal Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of UncleJim Show documentation
Show all versions of UncleJim Show documentation
Immutable Clojure collections and a Transformation abstraction for Java 8+, immutably, type-safely, and with good performance. Name will change to "Paguro" in November 2016.
package org.organicdesign.fp.collections;
import java.util.Map;
import java.util.Objects;
import org.organicdesign.fp.tuple.Tuple2;
import static org.organicdesign.fp.FunctionUtils.stringify;
/**
Replaced with {@link org.organicdesign.fp.tuple.Tuple2} and the shortcut
{@link org.organicdesign.fp.StaticImports#tup(Object, Object)}.
*/
@Deprecated
public class KeyVal extends Tuple2 {
/** Public static Key/Value factory method */
public static KeyVal of(K a, V b) { return new KeyVal<>(a, b); }
/** Public static Map.Entry factory method */
public static KeyVal of(Map.Entry entry) { return new KeyVal<>(entry); }
/** Key/Value Constructor */
public KeyVal(K k, V v) { super(k, v); }
/** Map.Entry Constructor */
public KeyVal(Map.Entry entry) { super(entry.getKey(), entry.getValue()); }
@Override public String toString() {
return "kv(" + stringify(_1) + "," + stringify(_2) + ")";
}
}