All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.lambdaworks.redis.KeyValue Maven / Gradle / Ivy

There is a newer version: 3.40.2
Show newest version
// Copyright (C) 2011 - Will Glozer.  All rights reserved.

package com.lambdaworks.redis;

/**
 * A key-value pair.
 *
 * @author Will Glozer
 */
public class KeyValue {
    public final K key;
    public final V value;

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

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        KeyValue that = (KeyValue) o;
        return key.equals(that.key) && value.equals(that.value);
    }

    @Override
    public int hashCode() {
        return 31 * key.hashCode() + value.hashCode();
    }

    @Override
    public String toString() {
        return String.format("(%s, %s)", key, value);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy