wjc
2025-01-07 90d5f028ccdaaaf64286f9d632cb335a4d0544b9
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
package com.hdl.sdk.link.common.utils;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.collection.ArrayMap;
 
import java.lang.reflect.Array;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
 
/**
 * Created by hxb on 2022/10/17.
 */
public class LockArrayList extends ArrayList {
    @Override
    public boolean add(Object o) {
        synchronized (this) {
            return super.add(o);
        }
    }
 
    @Override
    public boolean remove(@Nullable Object o) {
        synchronized (this) {
            return super.remove(o);
        }
    }
 
    @Override
    public boolean contains(@Nullable Object o) {
        synchronized (this) {
            return super.contains(o);
        }
    }
 
    //    @Nullable
//    @Override
//    public V put(K key, V value) {
//        synchronized (this) {
//            return super.put(key, value);
//        }
//    }
//
//    @Override
//    public boolean remove(Object key, Object value) {
//        synchronized (this) {
//            return super.remove(key, value);
//        }
//    }
//
//    @Override
//    public boolean containsKey(@Nullable Object key) {
//        synchronized (this) {
//            return super.containsKey(key);
//        }
//    }
 
}