/** * Created by IntelliJ IDEA. * User: me * Date: 15.09.2006 * Time: 17:05:51 * To change this template use File | Settings | File Templates. */ private String name; private long id; private transient boolean hashSet = false; private transient int hash; private static long nextID = 0; this.name = name; id = nextID++; } } public int hashCode() { if (!hashSet) { hash = name.hashCode(); hashSet = true; } return hash; } }