Class Pair<A,B>

java.lang.Object
com.intellij.openapi.util.Pair<A,B>
Direct Known Subclasses:
Pair.NonNull

public class Pair<A,B> extends Object
Generic wrapper around two related values.
  • Field Details

    • first

      public final A first
    • second

      @Nls public final B second
  • Constructor Details

  • Method Details

    • create

      @NotNull public static <A, B> @NotNull Pair<A,B> create(A first, B second)
    • createNonNull

      @NotNull public static <A, B> @NotNull Pair.NonNull<A,B> createNonNull(@NotNull A first, @NotNull B second)
    • pair

      @NotNull public static <A, B> @NotNull Pair<A,B> pair(A first, B second)
    • createFunction

      @NotNull public static <A, B> @NotNull Function<A,Pair<A,B>> createFunction(B value)
    • getFirst

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

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

      @NotNull public static <A, B> @NotNull Pair<A,B> empty()
    • getFirst

      public final A getFirst()
    • getSecond

      public final B getSecond()
    • equals

      public final boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • comparingByFirst

      public static <A extends Comparable<? super A>, B> Comparator<Pair<A,B>> comparingByFirst()
      Type Parameters:
      A - first value type (Comparable)
      B - second value type
      Returns:
      a comparator that compares pair values by first value
    • comparingBySecond

      public static <A, B extends Comparable<? super B>> Comparator<Pair<A,B>> comparingBySecond()
      Type Parameters:
      A - first value type
      B - second value type (Comparable)
      Returns:
      a comparator that compares pair values by second value