// This is what the equals method of class Integer // might look like: public boolean equals(Object o) { if (this == o) return true; if (o == null) return false; if (getClass() != o.getClass()) return false; Integer o1 = (Integer) o; return (intValue() == o1.intValue()); }