I need a data set that contains pairs of values. And you can check whether a pair exists in such set regardless of the pair's key/value order, that is:
If the set contains
<1,5>
<8,3>
And you ask if it contains <5,1>
, it will return true
because the order does not matter.
I could write my own Pair
class and design the hashCode()
and equals()
methods to account for my requirements, but I was wondering if Java has a library that serves this purpose already.