List of usage examples for java.util LinkedList removeIf
default boolean removeIf(Predicate<? super E> filter)
From source file:org.hyperledger.fabric.sdk.Channel.java
void runSweeper() { if (shutdown || DELTA_SWEEP < 1) { return;// w ww . java 2 s .c om } if (sweeper == null) { sweeperExecutorService = Executors.newSingleThreadScheduledExecutor(r -> { Thread t = Executors.defaultThreadFactory().newThread(r); t.setDaemon(true); return t; }); sweeper = sweeperExecutorService.scheduleAtFixedRate(() -> { try { if (txListeners != null) { synchronized (txListeners) { for (Iterator<Map.Entry<String, LinkedList<TL>>> it = txListeners.entrySet() .iterator(); it.hasNext();) { Map.Entry<String, LinkedList<TL>> es = it.next(); LinkedList<TL> tlLinkedList = es.getValue(); tlLinkedList.removeIf(TL::sweepMe); if (tlLinkedList.isEmpty()) { it.remove(); } } } } } catch (Exception e) { logger.warn("Sweeper got error:" + e.getMessage(), e); } }, 0, DELTA_SWEEP, TimeUnit.MILLISECONDS); } }