List of usage examples for java.util Iterator remove
default void remove()
From source file:at.ac.univie.isc.asio.brood.Catalog.java
/** * {@link #drop(Id) Drop} all present containers. * * @return all container that were present when closing *//*from ww w. j a v a 2 s. co m*/ Set<Container> clear() { log.info(Scope.SYSTEM.marker(), "clear - dropping all of {}", catalog.keySet()); final Set<Container> dropped = new HashSet<>(); final Iterator<Container> present = catalog.values().iterator(); while (present.hasNext()) { final Container next = present.next(); events.emit(dropEvent(next)); dropped.add(next); present.remove(); } return dropped; }
From source file:com.qmetry.qaf.automation.integration.qmetry.testnglistener.QmetryMethodSelector.java
@Override public void setTestMethods(List<ITestNGMethod> testMethods) { Iterator<ITestNGMethod> iter = testMethods.iterator(); while (iter.hasNext()) { ITestNGMethod m = iter.next();//from w w w . j av a 2s . c om if (m.isTest() && !secheduledTCs.contains(m.getMethodName())) { iter.remove(); } } }
From source file:com.microsoft.tfs.client.eclipse.ui.commands.vc.RemoveTPIgnorePatternsCommand.java
@Override protected IStatus doRun(final IProgressMonitor progressMonitor) throws Exception { if (ignoreFile.isReadOnly()) { final IStatus validateStatus = ignoreFile.getWorkspace().validateEdit(new IFile[] { ignoreFile }, null); if (validateStatus.isOK() == false) { return validateStatus; }//from ww w . j a va 2s . co m } /* * Load and remove matching lines. */ final TPIgnoreDocument doc = TPIgnoreDocument.read(ignoreFile); final List<Line> lines = doc.getLines(); for (final String pattern : patterns) { final Iterator<Line> iterator = lines.iterator(); while (iterator.hasNext()) { final Line line = iterator.next(); if (line.getContents().trim().equals(pattern.trim())) { iterator.remove(); } } } doc.setLines(lines); /* * Save the new document. This triggers the * TPIgnoreResourceChangeListener which refresh label decoration. */ ignoreFile.setContents(doc.getInputStream(), false, true, progressMonitor); return Status.OK_STATUS; }
From source file:de.dhke.projects.cutil.collections.iterator.MultiMapItemIteratorTest.java
@Test(expected = UnsupportedOperationException.class) public void testRemove() { _map.put("A", "1"); final Iterator<Map.Entry<String, String>> iter = MultiMapEntryIterator.decorate(_map); assertEquals(new DefaultMapEntry<>("A", "1"), iter.next()); iter.remove(); }
From source file:com.taobao.diamond.client.impl.PublishAllTaskProcessor.java
private boolean processPublish(PublishTask publishTask) { int count = publishTask.getCount(); int waitTime = getWaitTime(++count); log.info("" + count + ""); publishTask.setCount(count);/*from w ww .j a v a2s . c o m*/ String dataId = publishTask.getDataId(); String group = publishTask.getGroup(); Iterator<String> it = publishTask.getContents().iterator(); while (it.hasNext()) { String configInfo = it.next(); if (innerPublish(publishTask, waitTime, dataId, group, configInfo)) { it.remove(); } else { return false; } } return true; }
From source file:com.weibo.datasys.crawler.impl.strategy.rule.save.FieldSaveRule.java
@Override public Null apply(ParseInfo in) { List<CommonData> fields = in.getFields(this.type); if (fields != null && fields.size() > 0) { boolean isUseDefaultId = !StringUtils.isEmptyString(fields.get(0).getId()); if (!isUseDefaultId) { Set<String> idSet = new HashSet<String>(); Iterator<CommonData> iterator = fields.iterator(); while (iterator.hasNext()) { CommonData field = iterator.next(); if (!idSet.add(field.getBaseField(field.getBaseFieldNames().get(0)))) { iterator.remove(); }/* w w w.j a v a2s . c o m*/ } } StopWatch watch = new StopWatch(); watch.start(); logger.debug("[SaveFieldBatch] - start. type={} | count={}", new Object[] { this.type, fields.size() }); CommonDAO.getInstance().saveBatch(fields, dsname, db, table, true, false, false, isUseDefaultId); CrawlerMonitorInfo.addCounter("saveField_" + this.type, fields.size()); logger.debug("[SaveFieldBatch] - end. type={} | cost {}ms | count={}", new Object[] { this.type, watch.getElapsedTime(), fields.size() }); } return null; }
From source file:fr.dutra.confluence2wordpress.core.converter.visitors.AttributesCleaner.java
/** * @inheritdoc//from w w w . j a va2s .c om */ public boolean visit(TagNode parentNode, HtmlNode htmlNode) { if (htmlNode instanceof TagNode) { TagNode tag = (TagNode) htmlNode; //filter css classes: allow only css classes starting with "c2w" //all others will be useless once on the Wordpress side String classes = tag.getAttributeByName(CLASS); if (classes != null) { classes = filterCssClasses(classes); tag.setAttribute(CLASS, classes); classes = StringUtils.trimToNull(classes); if (classes == null) { tag.removeAttribute(CLASS); } else { tag.setAttribute(CLASS, classes); } } //remove "data-" or "confluence-" attributes Map<String, String> attributes = tag.getAttributes(); Iterator<String> iterator = attributes.keySet().iterator(); while (iterator.hasNext()) { String name = iterator.next(); if (name.startsWith("data-") || name.startsWith("confluence-")) { iterator.remove(); } } } return true; }
From source file:com.hp.autonomy.frontend.configuration.AbstractConfig.java
@Override @JsonIgnore//w w w .ja v a2s .co m public Map<String, ConfigurationComponent> getEnabledValidationMap() { final Map<String, ConfigurationComponent> validationMap = getValidationMap(); final Iterator<Map.Entry<String, ConfigurationComponent>> iterator = validationMap.entrySet().iterator(); while (iterator.hasNext()) { final Map.Entry<String, ConfigurationComponent> entry = iterator.next(); if (!entry.getValue().isEnabled()) { iterator.remove(); } } return validationMap; }
From source file:framework.retrieval.engine.pool.impl.IndexReaderPool.java
/** * //w ww . j a v a2 s . c o m */ public synchronized void clean() { log.debug("IndexReaderPool Clean indexReaderProxy............."); Iterator<String> it = indexPathTypes.iterator(); while (it.hasNext()) { String indexPathType = it.next(); interRemove(indexPathType); it.remove(); } log.debug("IndexReaderPool Clean complete............."); }
From source file:org.cloudfoundry.identity.uaa.login.feature.ResetPasswordIT.java
@Test public void resettingAPassword() throws Exception { // Go to Forgot Password page webDriver.get(baseUrl + "/login"); assertEquals("Cloud Foundry", webDriver.getTitle()); webDriver.findElement(By.linkText("Reset password")).click(); assertEquals("Reset Password", webDriver.findElement(By.tagName("h1")).getText()); // Enter an invalid email address webDriver.findElement(By.name("email")).sendKeys("notAnEmail"); webDriver.findElement(By.xpath("//input[@value='Send reset password link']")).click(); assertThat(webDriver.findElement(By.className("error-message")).getText(), Matchers.equalTo("Please enter a valid email address.")); // Successfully enter email address int receivedEmailSize = simpleSmtpServer.getReceivedEmailSize(); webDriver.findElement(By.name("email")).sendKeys(userEmail); webDriver.findElement(By.xpath("//input[@value='Send reset password link']")).click(); assertEquals("Instructions Sent", webDriver.findElement(By.tagName("h1")).getText()); // Check email assertEquals(receivedEmailSize + 1, simpleSmtpServer.getReceivedEmailSize()); Iterator receivedEmail = simpleSmtpServer.getReceivedEmail(); SmtpMessage message = (SmtpMessage) receivedEmail.next(); receivedEmail.remove(); assertEquals(userEmail, message.getHeaderValue("To")); assertThat(message.getBody(), containsString("Reset your password")); assertEquals("Please check your email for a reset password link.", webDriver.findElement(By.cssSelector(".instructions-sent")).getText()); // Click link in email String link = testClient.extractLink(message.getBody()); webDriver.get(link);//from w ww . j a v a2s . co m // Enter invalid password information webDriver.findElement(By.name("password")).sendKeys("newsecret"); webDriver.findElement(By.name("password_confirmation")).sendKeys(""); webDriver.findElement(By.xpath("//input[@value='Create new password']")).click(); assertThat(webDriver.findElement(By.cssSelector(".error-message")).getText(), containsString("Passwords must match and not be empty.")); // Successfully choose password webDriver.findElement(By.name("password")).sendKeys("newsecret"); webDriver.findElement(By.name("password_confirmation")).sendKeys("newsecret"); webDriver.findElement(By.xpath("//input[@value='Create new password']")).click(); assertThat(webDriver.findElement(By.cssSelector("h1")).getText(), containsString("Where to?")); // Log out and back in with new password webDriver.findElement(By.xpath("//*[text()='" + userEmail + "']")).click(); webDriver.findElement(By.linkText("Sign Out")).click(); webDriver.findElement(By.name("username")).sendKeys(userEmail); webDriver.findElement(By.name("password")).sendKeys("newsecret"); webDriver.findElement(By.xpath("//input[@value='Sign in']")).click(); assertThat(webDriver.findElement(By.cssSelector("h1")).getText(), containsString("Where to?")); // Attempt to use same code again webDriver.findElement(By.xpath("//*[text()='" + userEmail + "']")).click(); webDriver.findElement(By.linkText("Sign Out")).click(); webDriver.get(link); webDriver.findElement(By.name("password")).sendKeys("newsecret"); webDriver.findElement(By.name("password_confirmation")).sendKeys("newsecret"); webDriver.findElement(By.xpath("//input[@value='Create new password']")).click(); assertThat(webDriver.findElement(By.cssSelector(".error-message")).getText(), containsString( "Sorry, your reset password link is no longer valid. You can request another one below.")); }