New file |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |