INNER CODE UNIT · Java
contains
objectbox/objectbox-java · objectbox-java/src/main/java/io/objectbox/Box.java:340
public boolean contains(long id) {
Cursor<T> reader = getReader();
try {
return reader.seek(id);
} finally {
releaseReader(reader);
}
}
/**
* Puts the given object and returns its (new) ID.
* <p>
* This means that if its {@link Id @Id} property is 0 or null, it is inserted as a new object and assigned the next
* available ID. For example, if there is an object with ID 1 and another with ID 100, it will be assigned ID 101.
* The new ID is also set on the given object before this returns.
* <p>
* If instead the object has an assigned ID set, if an object with the same ID exists it is updated. Otherwise, it
* is inserted with that ID.