@Override public int hashCode() { String realmName = realm.getPath(); String tableName = row.getTable().getName(); long rowIndex = row.getIndex(); int result = 17; result = 31 * result + ((realmName != null) ? realmName.hashCode() : 0); result = 31 * result + ((tableName != null) ? tableName.hashCode() : 0); result = 31 * result + (int) (rowIndex ^ (rowIndex >>> 32)); return result; }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } DynamicRealmObject other = (DynamicRealmObject) o; String path = realm.getPath(); String otherPath = other.realm.getPath(); if (path != null ? !path.equals(otherPath) : otherPath != null) { return false; } String tableName = row.getTable().getName(); String otherTableName = other.row.getTable().getName(); if (tableName != null ? !tableName.equals(otherTableName) : otherTableName != null) { return false; } return row.getIndex() == other.row.getIndex(); }
/** * Deletes this object from the Realm. Accessing any fields after removing the object will throw * an {@link IllegalStateException}. */ public void removeFromRealm() { row.getTable().moveLastOver(row.getIndex()); row = InvalidRow.INSTANCE; }