类 Pair<K,​V>

  • 类型参数:
    K - the key type
    V - the value type
    所有已实现的接口:
    java.io.Serializable, java.util.Map.Entry<K,​V>

    public class Pair<K,​V>
    extends java.lang.Object
    implements java.util.Map.Entry<K,​V>, java.io.Serializable
    Immutable Pair/Tuple2.
    另请参阅:
    序列化表格
    • 方法概要

      所有方法 静态方法 实例方法 具体方法 
      修饰符和类型 方法 说明
      <C> Triple<K,​V,​C> append​(C third)
      Append a new value.
      boolean equals​(java.lang.Object o)  
      K first()
      The first value of this tuple
      K getKey()  
      V getValue()  
      int hashCode()  
      static <K,​V>
      Pair<K,​V>
      of​(K key, V value)
      Create a new pair
      <A> Triple<A,​K,​V> prepend​(A value)
      Prepend a new value.
      V second()
      The second value of this tuple
      V setValue​(V value)  
      java.lang.String toString()  
      Pair<K,​V> withFirst​(K first)
      Create one new pair, replace the first value with new value.
      Pair<K,​V> withKey​(K newKey)
      Create one new pair, replace the key with newKey.
      Pair<K,​V> withSecond​(V second)
      Create one new pair, replace the second value with new value.
      Pair<K,​V> withValue​(V newValue)
      Create one new pair, replace the value with newValue.
      • 从类继承的方法 java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • 方法详细资料

      • of

        public static <K,​V> Pair<K,​V> of​(K key,
                                                     V value)
        Create a new pair
      • getKey

        public K getKey()
        指定者:
        getKey 在接口中 java.util.Map.Entry<K,​V>
      • getValue

        public V getValue()
        指定者:
        getValue 在接口中 java.util.Map.Entry<K,​V>
      • withKey

        public Pair<K,​V> withKey​(K newKey)
        Create one new pair, replace the key with newKey.
      • withValue

        public Pair<K,​V> withValue​(V newValue)
        Create one new pair, replace the value with newValue.
      • first

        public K first()
        The first value of this tuple
      • second

        public V second()
        The second value of this tuple
      • withFirst

        public Pair<K,​V> withFirst​(K first)
        Create one new pair, replace the first value with new value.
      • withSecond

        public Pair<K,​V> withSecond​(V second)
        Create one new pair, replace the second value with new value.
      • append

        public <C> Triple<K,​V,​C> append​(C third)
        Append a new value.
        参数:
        third - the new value
        返回:
        Triple hold the Pair's value and new value
      • prepend

        public <A> Triple<A,​K,​V> prepend​(A value)
        Prepend a new value.
        参数:
        value - the new value
        返回:
        Triple hold new value and the Pair's value
      • setValue

        public V setValue​(V value)
        指定者:
        setValue 在接口中 java.util.Map.Entry<K,​V>
      • equals

        public boolean equals​(java.lang.Object o)
        指定者:
        equals 在接口中 java.util.Map.Entry<K,​V>
        覆盖:
        equals 在类中 java.lang.Object
      • hashCode

        public int hashCode()
        指定者:
        hashCode 在接口中 java.util.Map.Entry<K,​V>
        覆盖:
        hashCode 在类中 java.lang.Object
      • toString

        public java.lang.String toString()
        覆盖:
        toString 在类中 java.lang.Object