Class Pair<X,​Y>

java.lang.Object
com.onenetwork.platform.tools.collections.Pair<X,​Y>

public class Pair<X,​Y>
extends java.lang.Object
A simple container class for a typed pair of objects.
  • Field Summary

    Fields 
    Modifier and Type Field Description
    X first
    First object in the pair
    Y second
    Second object in the pair
  • Constructor Summary

    Constructors 
    Constructor Description
    Pair​(X first, Y second)
    Creates a pair and assigns both members.
  • Method Summary

    Modifier and Type Method Description
    static boolean eq​(java.lang.Object a, java.lang.Object b)
    Statically compares two objects for equality.
    boolean equals​(java.lang.Object other)  
    int hashCode()  
    static <X,​ Y> Pair<X,​Y> pair​(X first, Y second)
    Static utility function for instantiating a new pair, inferring type.
    java.lang.String toString()  

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • first

      public X first
      First object in the pair
    • second

      public Y second
      Second object in the pair
  • Constructor Details

    • Pair

      public Pair​(X first, Y second)
      Creates a pair and assigns both members.
  • Method Details

    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class java.lang.Object
    • equals

      public boolean equals​(java.lang.Object other)
      Overrides:
      equals in class java.lang.Object
    • eq

      public static boolean eq​(java.lang.Object a, java.lang.Object b)
      Statically compares two objects for equality.
    • pair

      public static <X,​ Y> Pair<X,​Y> pair​(X first, Y second)
      Static utility function for instantiating a new pair, inferring type.
    • toString

      public java.lang.String toString()
      Overrides:
      toString in class java.lang.Object