This is a Java solution to the stable marriage problem.