I use Commons Math heavily, and have adopted its Pair class for the cases where I need, well, a pair of things.
The attached patch adds three small improvements to the Pair class:
- toString() method
- factory method ".create()" to avoid duplicating generic types on instance creation
- a Comparator
Tests are included. I won't feel offended if this is rejected or modified but just wanted to supply the suggestion.