List of usage examples for java.util Iterator remove
default void remove()
From source file:io.neba.core.selftests.SelftestRegistrar.java
private synchronized void removeSelftests(Bundle bundle) { this.logger.info("Removing bundle " + displayNameOf(bundle) + " from the selftest registry..."); Iterator<SelftestReference> i = this.selftestReferences.iterator(); while (i.hasNext()) { if (i.next().getBundleId() == bundle.getBundleId()) { i.remove(); }//from w ww. ja va2 s . c om } this.logger.info("Bundle " + displayNameOf(bundle) + " was removed from the selftest registry."); }
From source file:eu.esdihumboldt.hale.ui.service.project.internal.RecentFilesServiceImpl.java
/** * @see RecentFilesService#add(String, String) *//*from www.j a v a 2 s.c om*/ @Override public void add(String file, String projectName) { if (file != null) { if (projectName == null) projectName = ""; Entry entry = new EntryImpl(file, projectName); Iterator<?> i = _buffer.iterator(); while (i.hasNext()) { Entry rfe = (Entry) i.next(); if (entry.equals(rfe)) { i.remove(); break; } } _buffer.add(entry); } }
From source file:eu.europa.ec.fisheries.uvms.plugins.ais.service.AisService.java
@PreDestroy public void destroy() { if (connection != null) { connection.close();/* w w w .java 2s .com*/ } Iterator<Future<Long>> processIterator = processes.iterator(); while (processIterator.hasNext()) { Future<Long> process = processIterator.next(); if (process.isDone() || process.isCancelled()) { processIterator.remove(); } else { process.cancel(true); } } }
From source file:com.almende.pi5.common.agents.LoggerAgent.java
/** * Forget.// w w w .j av a2 s . c o m * * @param days * the days */ public void forget(@Optional @Name("days") Integer days) { if (days == null) { days = 7; } final long gauge = getScheduler().nowDateTime().minusDays(days).getMillis(); synchronized (logs) { final Iterator<LogLine> iter = logs.iterator(); while (iter.hasNext()) { final LogLine ll = iter.next(); if (ll.getNow() < gauge) { iter.remove(); } else { // Although logs isn't entirely chronologic, the differences // isn't big enough to warrant full transfersal. break; } } } }
From source file:org.wallride.support.CategoryUtils.java
public List<TreeNode<Category>> getNodes(boolean includeNoArticle) { Collection<Category> categories = categoryService .getCategories(LocaleContextHolder.getLocale().getLanguage(), includeNoArticle); List<TreeNode<Category>> rootNodes = new ArrayList<>(); Iterator<Category> i = categories.iterator(); while (i.hasNext()) { Category Category = i.next();/*from www.jav a 2 s.c o m*/ if (Category.getParent() == null) { TreeNode<Category> node = new TreeNode<>(Category); rootNodes.add(node); i.remove(); } } for (TreeNode<Category> node : rootNodes) { createNode(node, categories); } return rootNodes; }
From source file:org.esxx.js.protocol.PreemptiveSchemes.java
public synchronized PreemptiveScheme find(String uri) { Iterator<PreemptiveScheme> i = schemes.iterator(); while (i.hasNext()) { PreemptiveScheme ps = i.next();/* ww w. j av a2 s . co m*/ if (ps.matches(uri)) { // Move ps to the front of the LRU list and return i.remove(); schemes.addFirst(ps); return ps; } } return null; }
From source file:ezbake.locksmith.service.EzLocksmithHandler.java
@Override public void shutdown() { log.info("Shutting down {}", EzLocksmithHandler.class.getSimpleName()); Iterator<EzLocksmithHandler> it = instances.iterator(); while (it.hasNext()) { it.next().stop();//from w w w. j a va2s . c o m it.remove(); } }
From source file:io.tilt.minka.spectator.Queues.java
/** * If you plan to dinamically consume from a lot of Queues, you should release them when no longer care. * Otherwise non stopped subscription resources will only be released at shutdown * (subject to proper termination)/* w w w . j a v a 2 s. c om*/ * @param topicName */ public void stopSubscription(final String topicName) { Set<UserInstanceObject> set = getUserMap().get(topicName); if (set != null) { Iterator<UserInstanceObject> it = set.iterator(); while (it.hasNext()) { UserInstanceObject uio = it.next(); if (uio.getTree() != null) { uio.getTree().close(); it.remove(); } } } }
From source file:com.edgenius.wiki.security.Policy.java
public boolean removeAttribute(String attribute) { SecurityConfig config = new SecurityConfig(attribute); Iterator<ConfigAttribute> iter = attributes.iterator(); while (iter.hasNext()) { ConfigAttribute att = iter.next(); if (att.equals(config)) { iter.remove(); return true; }//from w w w . j a va2s .com } return false; }
From source file:cs544.videohouse.domain.Video.java
public void removeComment(Comment comment) { Iterator<Comment> i = comments.iterator(); while (i.hasNext()) { Comment c = i.next();//from w ww. ja v a 2 s. co m if (c == comment) { i.remove(); break; } } }