> public class Pair<A, B> {
>   public A fst;
>   public B snd;
>   public Pair(A fst, B snd) {
>     this.fst = fst;
>     this.snd = snd;
>   }
> }

OK, I don't even understand that syntax. Have they changed the Java
language spec or something?

Yes.  As of version 5 (or 1.5, or whatever you want to call it), Java has parametric polymorphism.  Do a Google search for "Java generics".

-Brent