本文整理汇总了Java中java.util.concurrent.CopyOnWriteArrayList.remove方法的典型用法代码示例。如果您正苦于以下问题:Java CopyOnWriteArrayList.remove方法的具体用法?Java CopyOnWriteArrayList.remove怎么用?Java CopyOnWriteArrayList.remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.util.concurrent.CopyOnWriteArrayList
的用法示例。
在下文中一共展示了CopyOnWriteArrayList.remove方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: removeCharacteristicsChangedListener
import java.util.concurrent.CopyOnWriteArrayList; //导入方法依赖的package包/类
@Override
@SuppressWarnings("PMD.CompareObjectsWithEquals")
public void removeCharacteristicsChangedListener(UUID characteristicsUUID, CharacteristicsChangedListener listener) {
boolean checkIdle;
synchronized (lock) {
CopyOnWriteArrayList<CharacteristicsChangedListener> list = changeListeners.get(characteristicsUUID);
if (list != null) {
list.remove(listener);
if (list.isEmpty()) {
changeListeners.remove(characteristicsUUID);
}
}
checkIdle = currentCallback == DO_NOTHING_CALLBACK && queue.isEmpty() && queue.isEmpty();
}
if (checkIdle) {
disconnectOnIdle();
}
}
示例2: unRegister
import java.util.concurrent.CopyOnWriteArrayList; //导入方法依赖的package包/类
/**
* 一次性注销所有当前事件监听器
*
* @param ev
* @return
*/
public OkBus unRegister(Event ev) {
for (int i = 0; i < mEventList.values().size(); i++) {
CopyOnWriteArrayList<SparseArray<Event>> list = (CopyOnWriteArrayList<SparseArray<Event>>) mEventList.values().toArray()[i];
int key = (int) mEventList.keySet().toArray()[i];
for (SparseArray<Event> item : list) {
if (item.indexOfValue(ev) >= 0) {
list.remove(item);
LogUtils.e("remove Event", "key :" + key + " keys:" + item.toString());
}
}
}
return this;
}
示例3: main
import java.util.concurrent.CopyOnWriteArrayList; //导入方法依赖的package包/类
public static void main(String... args) { //it's correct line
CopyOnWriteArrayList<String> list = new CopyOnWriteArrayList();
list.add("A");
list.add("B");
list.add("C");
list.remove("B");
List<String> collection = Arrays.asList(new String[]{"B", "C", "D", "B"});
list.addAllAbsent(collection);
for (String string : list) {
System.out.println(string);
}
}
示例4: removeObserver
import java.util.concurrent.CopyOnWriteArrayList; //导入方法依赖的package包/类
/**
* 给某一个任务移除某一个监听器
*
* @param taskId
* 任务ID
* @param observer
* 监听器
*/
@Override
public void removeObserver(String taskId, Observer observer) {
if (taskObservers.containsKey(taskId)) {
CopyOnWriteArrayList<Observer> observerList = taskObservers.get(taskId);
if (observerList != null && observerList.contains(observer)) {
observerList.remove(observer);
}
}
}
示例5: filter
import java.util.concurrent.CopyOnWriteArrayList; //导入方法依赖的package包/类
public static <T> List<T> filter(Collection<T> c, Predictor<T> p) {
CopyOnWriteArrayList<T> tmp = new CopyOnWriteArrayList<T>(c);
for (T t : tmp) {
if (p.apply(t)) {
tmp.remove(t);
}
}
return tmp;
}