File tree Expand file tree Collapse file tree 1 file changed +5
-15
lines changed
objectbox-java/src/main/java/io/objectbox Expand file tree Collapse file tree 1 file changed +5
-15
lines changed Original file line number Diff line number Diff line change @@ -303,26 +303,16 @@ public boolean isEmpty() {
303303
304304 /**
305305 * Returns all stored Objects in this Box.
306+ * @return since 2.4 the returned list is always mutable (before an empty result list was immutable)
306307 */
307308 public List <T > getAll () {
309+ ArrayList <T > list = new ArrayList <>();
308310 Cursor <T > cursor = getReader ();
309311 try {
310- T first = cursor .first ();
311- if (first == null ) {
312- return Collections .emptyList ();
313- } else {
314- ArrayList <T > list = new ArrayList <>();
315- list .add (first );
316- while (true ) {
317- T next = cursor .next ();
318- if (next != null ) {
319- list .add (next );
320- } else {
321- break ;
322- }
323- }
324- return list ;
312+ for (T object = cursor .first (); object != null ; object = cursor .next ()) {
313+ list .add (object );
325314 }
315+ return list ;
326316 } finally {
327317 releaseReader (cursor );
328318 }
You can’t perform that action at this time.
0 commit comments