类 Pair<K,V>
- java.lang.Object
-
- net.dongliu.commons.collection.Pair<K,V>
-
- 类型参数:
K- the key typeV- 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.SerializableImmutable Pair/Tuple2.- 另请参阅:
- 序列化表格
-
-
方法概要
所有方法 静态方法 实例方法 具体方法 修饰符和类型 方法 说明 <C> Triple<K,V,C>append(C third)Append a new value.booleanequals(java.lang.Object o)Kfirst()The first value of this tupleKgetKey()VgetValue()inthashCode()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.Vsecond()The second value of this tupleVsetValue(V value)java.lang.StringtoString()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.
-
-
-
方法详细资料
-
of
public static <K,V> Pair<K,V> of(K key, V value)
Create a new pair
-
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
-
equals
public boolean equals(java.lang.Object o)
-
hashCode
public int hashCode()
-
toString
public java.lang.String toString()
- 覆盖:
toString在类中java.lang.Object
-
-