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

org.sophon.commons.core.KeyValue Maven / Gradle / Ivy

package org.sophon.commons.core;

import java.io.Serializable;

/**
 * 键值对
 * @author moushaokun
 * @since time: 2023-02-16 21:55
 */
public class KeyValue implements Serializable {
    private static final long serialVersionUID = 6111391482629646061L;

    /** 键 */
    private K key;

    /** 值 */
    private V value;

    public KeyValue(){}

    public K getKey() {
        return key;
    }

    public KeyValue setKey(K key) {
        this.key = key;
        return this;
    }

    public V getValue() {
        return value;
    }

    public KeyValue setValue(V value) {
        this.value = value;
        return this;
    }

    @Override
    public String toString() {
        return "KeyValue(key=" + this.getKey() + ", value=" + this.getValue() + ")";
    }

    public static  KeyValue of(K key, V value){
        return new KeyValue().setKey(key).setValue(value);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy