mac
2023-11-22 3f41182984d69d7fae703776edd1591f48dff93f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
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);
        }
    }
}