File tree Expand file tree Collapse file tree 3 files changed +25
-9
lines changed
objectbox-java/src/main/java/io/objectbox
tests/objectbox-java-test/src/test/java/io/objectbox Expand file tree Collapse file tree 3 files changed +25
-9
lines changed Original file line number Diff line number Diff line change @@ -20,8 +20,9 @@ Other languages/bindings
20
20
ObjectBox is a multi platform database supporting multiple language.
21
21
Besides JVM based languages like Java and Kotlin, ObjectBox also offers:
22
22
23
+ * [ ObjectBox Swift] ( https://github.com/objectbox/objectbox-swift ) : build fast mobile apps for iOS (and macOS)
24
+ * [ ObjectBox Go] ( https://github.com/objectbox/objectbox-go ) : great for data-driven tools and small server applications
23
25
* [ ObjectBox C API] ( https://github.com/objectbox/objectbox-c ) : native speed with zero copy access to FlatBuffer objects
24
- * ObjectBox Swift: [ coming soon] ( https://objectbox.io/ios-alpha/ )
25
26
26
27
Gradle setup
27
28
------------
@@ -68,13 +69,12 @@ For details please check the [docs](http://objectbox.io/documentation/).
68
69
69
70
Links
70
71
-----
71
- [ Features] ( http ://objectbox.io/features/)
72
+ [ Features] ( https ://objectbox.io/features/)
72
73
73
- [ Documentation ] ( http ://objectbox.io/documentation /)
74
+ [ Docs & Changelog ] ( https ://docs. objectbox.io/)
74
75
75
76
[ Examples] ( https://github.com/objectbox/objectbox-examples )
76
77
77
- [ Changelog] ( http://objectbox.io/changelog/ )
78
78
79
79
We love to get your feedback
80
80
----------------------------
Original file line number Diff line number Diff line change @@ -294,6 +294,11 @@ public long count(long maxCount) {
294
294
}
295
295
}
296
296
297
+ /** Returns true if no objects are in this box. */
298
+ public boolean isEmpty () {
299
+ return count (1 ) == 0 ;
300
+ }
301
+
297
302
@ Temporary
298
303
public List <T > find (Property property , String value ) {
299
304
Cursor <T > reader = getReader ();
@@ -580,11 +585,6 @@ public void attach(T entity) {
580
585
}
581
586
}
582
587
583
- // Sketching future API extension
584
- private boolean isEmpty () {
585
- return false ;
586
- }
587
-
588
588
// Sketching future API extension
589
589
private boolean isChanged (T entity ) {
590
590
return false ;
Original file line number Diff line number Diff line change @@ -251,4 +251,20 @@ public void testGetId() {
251
251
assertEquals (entity .getId (), box .getId (entity ));
252
252
}
253
253
254
+ @ Test
255
+ public void testCountMaxAndIsEmpty () {
256
+ assertTrue (box .isEmpty ());
257
+ putTestEntity ("banana" , 0 );
258
+ assertFalse (box .isEmpty ());
259
+
260
+ assertEquals (1 , box .count (1 ));
261
+ assertEquals (1 , box .count (2 ));
262
+ putTestEntity ("apple" , 0 );
263
+ assertEquals (2 , box .count (2 ));
264
+ assertEquals (2 , box .count (3 ));
265
+
266
+ box .removeAll ();
267
+ assertTrue (box .isEmpty ());
268
+ }
269
+
254
270
}
You can’t perform that action at this time.
0 commit comments