My solution was:
public class Pair extends java.util.AbstractMap.SimpleImmutableEntry {
public Pair( F f, S s ) {
super( f, s );
}
public F getFirst() {
return getKey();
}
public S getSecond() {
return getValue();
}
public String toString() {
return "["+getKey()+","+getValue()+"]";
}
}
Very simple, with all the benefits of the wrapped AbstractMap.SimpleImmutableEntry class.