File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
objectbox-java/src/main/java/io/objectbox Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -276,9 +276,18 @@ public Map<Long, T> getMap(Iterable<Long> ids) {
276276 * Returns the count of all stored objects in this box.
277277 */
278278 public long count () {
279+ return count (0 );
280+ }
281+
282+ /**
283+ * Returns the count of all stored objects in this box or the given maxCount, whichever is lower.
284+ *
285+ * @param maxCount maximum value to count or 0 (zero) to have no maximum limit
286+ */
287+ public long count (long maxCount ) {
279288 Cursor <T > reader = getReader ();
280289 try {
281- return reader .count ();
290+ return reader .count (maxCount );
282291 } finally {
283292 releaseReader (reader );
284293 }
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ public abstract class Cursor<T> implements Closeable {
5858
5959 static native Object nativeFirstEntity (long cursor );
6060
61- static native long nativeCount (long cursor );
61+ static native long nativeCount (long cursor , long maxCountOrZero );
6262
6363 static native List nativeFindScalarPropertyId (long cursor , int propertyId , long value );
6464
@@ -215,8 +215,8 @@ public boolean seek(long key) {
215215 return nativeSeek (cursor , key );
216216 }
217217
218- public long count () {
219- return nativeCount (cursor );
218+ public long count (long maxCountOrZero ) {
219+ return nativeCount (cursor , maxCountOrZero );
220220 }
221221
222222 @ Override
You can’t perform that action at this time.
0 commit comments