GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Merge branch 'dev-minor' into dev · heyujava/objectbox-java@e324da4

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • README.md
  • objectbox-java/src/main/java/io/objectbox
    • Box.java
  • tests/objectbox-java-test/src/test/java/io/objectbox
    • BoxTest.java
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎README.md‎

Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,9 @@ Other languages/bindings
2020
ObjectBox is a multi platform database supporting multiple language.
2121
Besides JVM based languages like Java and Kotlin, ObjectBox also offers:
2222

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
2325
* [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/)
2526

2627
Gradle setup
2728
------------
@@ -68,13 +69,12 @@ For details please check the [docs](http://objectbox.io/documentation/).
6869

6970
Links
7071
-----
71-
[Features](http://objectbox.io/features/)
72+
[Features](https://objectbox.io/features/)
7273

73-
[Documentation](http://objectbox.io/documentation/)
74+
[Docs & Changelog](https://docs.objectbox.io/)
7475

7576
[Examples](https://github.com/objectbox/objectbox-examples)
7677

77-
[Changelog](http://objectbox.io/changelog/)
7878

7979
We love to get your feedback
8080
----------------------------
Collapse file

‎objectbox-java/src/main/java/io/objectbox/Box.java‎

Copy file name to clipboardExpand all lines: objectbox-java/src/main/java/io/objectbox/Box.java
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -294,6 +294,11 @@ public long count(long maxCount) {
294294
}
295295
}
296296

297+
/** Returns true if no objects are in this box. */
298+
public boolean isEmpty() {
299+
return count(1) == 0;
300+
}
301+
297302
@Temporary
298303
public List<T> find(Property property, String value) {
299304
Cursor<T> reader = getReader();
@@ -580,11 +585,6 @@ public void attach(T entity) {
580585
}
581586
}
582587

583-
// Sketching future API extension
584-
private boolean isEmpty() {
585-
return false;
586-
}
587-
588588
// Sketching future API extension
589589
private boolean isChanged(T entity) {
590590
return false;
Collapse file

‎tests/objectbox-java-test/src/test/java/io/objectbox/BoxTest.java‎

Copy file name to clipboardExpand all lines: tests/objectbox-java-test/src/test/java/io/objectbox/BoxTest.java
+16Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,4 +251,20 @@ public void testGetId() {
251251
assertEquals(entity.getId(), box.getId(entity));
252252
}
253253

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+
254270
}

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.