本文整理匯總了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;
}