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

com.dahuatech.hutool.core.lang.Pair Maven / Gradle / Ivy

There is a newer version: 1.0.13.10
Show newest version
package com.dahuatech.hutool.core.lang;

import com.dahuatech.hutool.core.clone.CloneSupport;

import java.io.Serializable;

/**
 * 键值对对象,只能在构造时传入键值
 *
 * @author looly
 * @param  键类型
 * @param  值类型
 * @since 4.1.5
 */
public class Pair extends CloneSupport> implements Serializable {
  private static final long serialVersionUID = 1L;

  private K key;
  private V value;

  /**
   * 构造
   *
   * @param key 键
   * @param value 值
   */
  public Pair(K key, V value) {
    this.key = key;
    this.value = value;
  }

  /**
   * 获取键
   *
   * @return 键
   */
  public K getKey() {
    return this.key;
  }

  /**
   * 获取值
   *
   * @return 值
   */
  public V getValue() {
    return this.value;
  }

  @Override
  public String toString() {
    return "Pair [key=" + key + ", value=" + value + "]";
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy