Class UnorderedPair<A,​B>

java.lang.Object
org.jgrapht.alg.util.Pair<A,​B>
org.jgrapht.alg.util.UnorderedPair<A,​B>
Type Parameters:
A - the first element type
B - the second element type
All Implemented Interfaces:
java.io.Serializable

public class UnorderedPair<A,​B>
extends Pair<A,​B>
implements java.io.Serializable
Generic unordered pair.

Although the instances of this class are immutable, it is impossible to ensure that the references passed to the constructor will not be modified by the caller.

Author:
Joris Kinable
See Also:
Serialized Form
  • Field Summary

    Fields inherited from class org.jgrapht.alg.util.Pair

    first, second
  • Constructor Summary

    Constructors 
    Constructor Description
    UnorderedPair​(A a, B b)
    Create a new unordered pair
  • Method Summary

    Modifier and Type Method Description
    boolean equals​(java.lang.Object o)  
    int hashCode()  
    static <A,​ B> UnorderedPair<A,​B> of​(A a, B b)
    Creates new unordered pair of elements pulling of the necessity to provide corresponding types of the elements supplied.
    java.lang.String toString()  

    Methods inherited from class org.jgrapht.alg.util.Pair

    getFirst, getSecond, hasElement, setFirst, setSecond

    Methods inherited from class java.lang.Object

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

    • UnorderedPair

      public UnorderedPair​(A a, B b)
      Create a new unordered pair
      Parameters:
      a - an element
      b - another element
  • Method Details

    • toString

      public java.lang.String toString()
      Overrides:
      toString in class Pair<A,​B>
    • equals

      public boolean equals​(java.lang.Object o)
      Overrides:
      equals in class Pair<A,​B>
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Pair<A,​B>
    • of

      public static <A,​ B> UnorderedPair<A,​B> of​(A a, B b)
      Creates new unordered pair of elements pulling of the necessity to provide corresponding types of the elements supplied.
      Type Parameters:
      A - the first element type
      B - the second element type
      Parameters:
      a - first element
      b - second element
      Returns:
      new unordered pair