@Override public boolean equals(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof XQSequenceType)) { return false; } XQSequenceType other = (XQSequenceType) obj; if (occurence != other.getItemOccurrence()) { return false; } if (occurence == OCC_EMPTY) { return true; } // here types can't be null return type.equals(other.getItemType()); }