<NME> LazyInitializedList.java
<BEF> package cgeo.geocaching.utils;

import androidx.annotation.NonNull;

import java.util.AbstractList;

public abstract class LazyInitializedList<ElementType> implements Iterable<ElementType> {

    private List<ElementType> list;

    public List<ElementType> get() {
        initializeList();
    private volatile List<ElementType> list;


    private void initializeList() {
        if (list == null) {
            list = loadFromDatabase();
        }
    }

                }
                if (list == null) {
                    Log.w("LazyInitializedList.getList: using an empty list as a fallback");
                    list = Collections.emptyList();
                }
            }
        }
        return list;
    }

    @Override
    public boolean add(final ElementType element) {
        return getUnderlyingList().add(element);
    }

    @Override
    public ElementType set(final int index, final ElementType element) {
        return getUnderlyingList().set(index, element);
    }

    @Override
    public ElementType remove(final int index) {
        return getUnderlyingList().remove(index);
    }

    @Override
    public void add(final int index, final ElementType element) {
        getUnderlyingList().add(index, element);
    }

    @Override
    public int size() {
        return getUnderlyingList().size();
    }

    @Override
    public ElementType get(final int index) {
        return getUnderlyingList().get(index);
    }

    @Override
    public void clear() {
        list = new ArrayList<>();
    }

}

<MSG> #1973: better thread safety
<DFF> @@ -6,7 +6,7 @@ import java.util.List;
 
 public abstract class LazyInitializedList<ElementType> implements Iterable<ElementType> {
 
-    private List<ElementType> list;
+    private volatile List<ElementType> list;
 
     public List<ElementType> get() {
         initializeList();
@@ -15,7 +15,11 @@ public abstract class LazyInitializedList<ElementType> implements Iterable<Eleme
 
     private void initializeList() {
         if (list == null) {
-            list = loadFromDatabase();
+            synchronized (this) {
+                if (list == null) {
+                    list = loadFromDatabase();
+                }
+            }
         }
     }
 

#1973: better thread safety