Class Pair<L,R>

java.lang.Object
icyllis.arc3d.core.Pair<L,R>
Type Parameters:
L - the left element type
R - the right element type
All Implemented Interfaces:
Map.Entry<L,R>

public class Pair<L,R> extends Object implements Map.Entry<L,R>
Immutable pair of two elements by default.
  • Constructor Details

    • Pair

      public Pair()
    • Pair

      public Pair(L left, R right)
  • Method Details

    • of

      @Nonnull public static <L, R> Pair<L,R> of(L left, R right)
    • of

      @Nonnull public static <L, R> Pair<L,R> of(Map.Entry<L,R> entry)
    • getKey

      public final L getKey()
      Specified by:
      getKey in interface Map.Entry<L,R>
      Returns:
      the key, may be null
    • getValue

      public final R getValue()
      Specified by:
      getValue in interface Map.Entry<L,R>
      Returns:
      the value, may be null
    • setValue

      public R setValue(R value)
      Specified by:
      setValue in interface Map.Entry<L,R>
    • getLeft

      public final L getLeft()
      Returns:
      the left element, may be null
    • getRight

      public final R getRight()
      Returns:
      the right element, may be null
    • getFirst

      public final L getFirst()
      Returns:
      the first element, may be null
    • getSecond

      public final R getSecond()
      Returns:
      the second element, may be null
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Map.Entry<L,R>
      Overrides:
      hashCode in class Object
      Returns:
      the hash code
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Map.Entry<L,R>
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
      Returns:
      a string representation of this object