Yes, I know, this can be made shorter. Don't really care. :-)public class You {private static Volkswagen vw;private static final class Popo extends Clown {private static int clowns = 0;private boolean unpacked = false;public Popo() { clowns++; }@Overridepublic int hashCode() {if (!unpacked && clowns < 20) {unpacked = true;vw.add(new Popo());}return super.hashCode();}}public static void main(String args[]) {vw = new Volkswagen();vw.add(new Popo());vw.done();}}
"The universe is not required to be in perfect harmony with human ambition."
Carl Sagan (1934 - 1996)
February 24, 2012
How to put twenty clowns in a Volkswagen
Context: here.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment