List of usage examples for java.util ListIterator hasNext
boolean hasNext();
From source file:VisitorExample.java
public void visit(Element node) { Namespace ns = node.getNamespace(); if (ns.getURI().equals(from.getURI())) { QName newQName = new QName(node.getName(), to); node.setQName(newQName);/* w ww . j a va2 s . co m*/ } ListIterator namespaces = node.additionalNamespaces().listIterator(); while (namespaces.hasNext()) { Namespace additionalNamespace = (Namespace) namespaces.next(); if (additionalNamespace.getURI().equals(from.getURI())) { namespaces.remove(); } } }
From source file:org.apache.gobblin.salesforce.SalesforceExtractor.java
private static String buildUrl(String path, List<NameValuePair> qparams) throws RestApiClientException { URIBuilder builder = new URIBuilder(); builder.setPath(path);/*from w w w .jav a 2 s . c o m*/ ListIterator<NameValuePair> i = qparams.listIterator(); while (i.hasNext()) { NameValuePair keyValue = i.next(); builder.setParameter(keyValue.getName(), keyValue.getValue()); } URI uri; try { uri = builder.build(); } catch (Exception e) { throw new RestApiClientException("Failed to build url; error - " + e.getMessage(), e); } return new HttpGet(uri).getURI().toString(); }
From source file:org.apache.sling.testing.clients.interceptors.StickyCookieInterceptor.java
public void process(HttpRequest httpRequest, HttpContext httpContext) throws HttpException, IOException { final HttpClientContext clientContext = HttpClientContext.adapt(httpContext); List<Cookie> cookies = clientContext.getCookieStore().getCookies(); boolean set = (null != StickyCookieHolder.getTestStickySessionCookie()); boolean found = false; ListIterator<Cookie> it = cookies.listIterator(); while (it.hasNext()) { Cookie cookie = it.next();/*www . j a v a2 s . co m*/ if (cookie.getName().equals(StickyCookieHolder.COOKIE_NAME)) { found = true; if (set) { // set the cookie with the value saved for each thread using the rule it.set(StickyCookieHolder.getTestStickySessionCookie()); } else { // if the cookie is not set in TestStickySessionRule, remove it from here it.remove(); } } } // if the cookie needs to be set from TestStickySessionRule but did not exist in the client cookie list, add it here. if (!found && set) { cookies.add(StickyCookieHolder.getTestStickySessionCookie()); } BasicCookieStore cs = new BasicCookieStore(); cs.addCookies(cookies.toArray(new Cookie[cookies.size()])); httpContext.setAttribute(HttpClientContext.COOKIE_STORE, cs); }
From source file:it.unimi.di.big.mg4j.document.tika.AbstractTikaDocumentFactory.java
@Override public int fieldIndex(String fieldName) { // TODO: use a map ListIterator<TikaField> li = fields().listIterator(); while (li.hasNext()) { if (li.next().mg4jName().equals(fieldName)) return li.previousIndex(); }// w w w . j a va2 s . c om return -1; }
From source file:edu.oregonstate.eecs.mcplan.SeriesAction.java
@Override public void doAction(final RandomGenerator rng, final S s) { assert (!done_); final ListIterator<A> itr = actions_.listIterator(); while (itr.hasNext()) { itr.next().doAction(s);//ww w . j av a 2 s.co m } done_ = true; }
From source file:org.iaws.controller.LineController.java
/** * Retourne le numero, le code des lignes. * @return /*from ww w . j a v a2s . c o m*/ */ private List<Pair<String, String>> getLineNameAndCode() { List<Pair<String, String>> list = new ArrayList<>(); ListIterator<Stop> it = areaStopList.listIterator(); while (it.hasNext()) { Stop iter = it.next(); Iterator<Destination> dest = iter.getDestination().iterator(); while (dest.hasNext()) { for (Line line : dest.next().getLines()) { Social social = socialMap.get(line.getShortName()); if (social != null) { line.setSocial(social); } else { line.setSocial(new Social(line.getShortName())); } list.add(new Pair(iter.getOperatorCode(), line.getShortName())); } } } return list; }
From source file:br.com.ingenieux.mojo.cloudfront.AbstractCloudfrontMojo.java
protected List<String> fetchLocalDistributionFiles(Distribution d) throws IOException { List<String> filenames = FileUtils.getFileNames(webappDirectory, d.includes, d.excludes, false); if (filenames.size() > 1000) getLog().warn("Wait! We still don't support > 1000 files. **USE AT YOUR OWN PERIL**"); ListIterator<String> listIterator = filenames.listIterator(); while (listIterator.hasNext()) { String f = listIterator.next(); String normalized = stripStart(FileUtils.normalize(f).replace('\\', '/'), "/"); listIterator.set(normalized);/*from w ww. j ava 2 s . c o m*/ } return filenames; }
From source file:net.duckling.ddl.service.mobile.ios.IOSMessageSender.java
private void dealNotice(List<PushedNotification> notice, IOSMessageBean bean) { ListIterator<PushedNotification> it = notice.listIterator(); while (it.hasNext()) { PushedNotification no = it.next(); if (!no.isSuccessful()) { LOG.error("send message " + bean + " error!", no.getException()); }/* ww w . j a v a2 s.c o m*/ } }
From source file:net.netheos.pcsapi.request.Headers.java
/** * Remove a header from the list// w w w . j ava 2 s . co m * * @param name The header name */ public void removeHeader(String name) { ListIterator<Header> it = headers.listIterator(); while (it.hasNext()) { if (it.next().getName().equals(name)) { it.remove(); } } }
From source file:RedundancyChecker.java
public boolean checkForRedundancy(List l) { ListIterator li1 = l.listIterator(); // Make a // general//w w w . j av a 2s. c om // ListIterator // on the list while (li1.hasNext()) { // Store the value of the actual first checked // element of the List, // it needs to be stored because it calls the // .next(), which we can call only once per loop // in order to sweep the whole list. int check1 = ((Integer) li1.next()).intValue(); // Make a second ListIterator that will start // with the element that is just after the // actual first checked one, // in order to avoid checking several times the // same elements. ListIterator li2 = l.listIterator(li1.nextIndex() + 1); while (li2.hasNext()) { // Store the following elements one by // one and check to see if they match // the actual one. int check2 = ((Integer) li2.next()).intValue(); if (check1 == check2) { System.out.println("Oh no! The value " + check1 + " is redundant."); return true; } } // The .next() method has already been called at // the beginning of the loop. } return false; }