类 Pair<A,B>

java.lang.Object
cn.taketoday.core.Pair<A,B>
类型参数:
A - type of the first value.
B - type of the second value.
所有已实现的接口:
Serializable

@Experimental public class Pair<A,B> extends Object implements Serializable
Represents a generic pair of two values. There is no meaning attached to values in this class, it can be used for any purpose. Pair exhibits value semantics, i.e. two pairs are equal if both components are equal. An example of decomposing it into values:
从以下版本开始:
4.0 2023/8/24 14:45
作者:
Harry Yang
另请参阅:
  • 字段详细资料

    • EMPTY

      public static final Pair EMPTY
    • serialVersionUID

      private static final long serialVersionUID
      另请参阅:
    • first

      @Nullable public final A first
    • second

      @Nullable public final B second
  • 构造器详细资料

  • 方法详细资料

    • getFirst

      @Nullable public final A getFirst()
    • getSecond

      @Nullable public final B getSecond()
    • withFirst

      public Pair<A,B> withFirst(@Nullable A first)
    • withSecond

      public Pair<A,B> withSecond(@Nullable B second)
    • equals

      public boolean equals(Object o)
      覆盖:
      equals 在类中 Object
    • hashCode

      public int hashCode()
      覆盖:
      hashCode 在类中 Object
    • toString

      public String toString()
      Returns string representation of the [Pair] including its [first] and [second] values.
      覆盖:
      toString 在类中 Object
    • empty

      public static <A, B> Pair<A,B> empty()
    • of

      public static <A, B> Pair<A,B> of(@Nullable A first, @Nullable B second)
    • getFirst

      @Nullable public static <T> T getFirst(@Nullable Pair<T,?> pair)
    • getSecond

      @Nullable public static <T> T getSecond(@Nullable Pair<?,T> pair)
    • comparingFirst

      public static <A extends Comparable<? super A>, B> Comparator<Pair<A,B>> comparingFirst()
      类型参数:
      A - first value type (Comparable)
      B - second value type
      返回:
      a comparator that compares pair values by first value
    • comparingSecond

      public static <A, B extends Comparable<? super B>> Comparator<Pair<A,B>> comparingSecond()
      类型参数:
      A - first value type
      B - second value type (Comparable)
      返回:
      a comparator that compares pair values by second value