wjc
2023-06-28 14de918a79943e4961b09fa01ed320c6cad41f2e
HDLLinkLocalSdk/src/main/java/com/hdl/sdk/link/common/utils/LockList.java
New file
@@ -0,0 +1,37 @@
package com.hdl.sdk.link.common.utils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.collection.ArrayMap;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
/**
 * Created by hxb on 2022/10/17.
 */
public class LockList<T> extends ArrayList<T> {
    @Override
    public boolean add(T t) {
        synchronized (this) {
            return super.add(t);
        }
    }
    @Override
    public T remove(int index) {
        synchronized (this) {
            return super.remove(index);
        }
    }
    @Override
    public boolean contains(@Nullable Object o) {
        synchronized (this) {
            return super.contains(o);
        }
    }
}