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) {
276
276
* Returns the count of all stored objects in this box.
277
277
*/
278
278
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 ) {
279
288
Cursor <T > reader = getReader ();
280
289
try {
281
- return reader .count ();
290
+ return reader .count (maxCount );
282
291
} finally {
283
292
releaseReader (reader );
284
293
}
Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ public abstract class Cursor<T> implements Closeable {
58
58
59
59
static native Object nativeFirstEntity (long cursor );
60
60
61
- static native long nativeCount (long cursor );
61
+ static native long nativeCount (long cursor , long maxCountOrZero );
62
62
63
63
static native List nativeFindScalarPropertyId (long cursor , int propertyId , long value );
64
64
@@ -215,8 +215,8 @@ public boolean seek(long key) {
215
215
return nativeSeek (cursor , key );
216
216
}
217
217
218
- public long count () {
219
- return nativeCount (cursor );
218
+ public long count (long maxCountOrZero ) {
219
+ return nativeCount (cursor , maxCountOrZero );
220
220
}
221
221
222
222
@ Override
You can’t perform that action at this time.
0 commit comments