Example usage for java.util ListIterator next

List of usage examples for java.util ListIterator next

Introduction

In this page you can find the example usage for java.util ListIterator next.

Prototype

E next();

Source Link

Document

Returns the next element in the list and advances the cursor position.

Usage

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);/*from w w  w . j av a  2  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.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();
        if (cookie.getName().equals(StickyCookieHolder.COOKIE_NAME)) {
            found = true;/*  ww w  .j ava2s .  c  om*/
            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();
    }/*from   w  w  w  . j a v a 2s.c o  m*/
    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);
    }//from w  w  w.  ja  v a  2 s  .c  o m
    done_ = true;
}

From source file:org.iaws.controller.LineController.java

/**
 * Retourne le numero, le code des lignes.
 * @return //w  w  w. j av  a 2 s. 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:net.netheos.pcsapi.request.Headers.java

/**
 * Remove a header from the list/*from w  w  w.j  a va2 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: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 w w.ja  v  a  2s  .  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  a 2 s .  c  o  m
    }
}

From source file:ListOfLists.java

public int indexOf(Object o) {
    ListIterator e = listIterator();
    if (o == null) {
        while (e.hasNext()) {
            if (e.next() == null)
                return e.previousIndex();
        }/* ww  w. java 2  s . c  om*/
    } else {
        Object el;
        while (e.hasNext()) {
            el = e.next();
            if (el.equals(o))
                return e.previousIndex();
        }
    }
    return -1;
}

From source file:edu.cuny.util.SortedTreeList.java

@Override
public String toString() {
    String s = " [";
    final ListIterator<E> iterator = listIterator();
    while (iterator.hasNext()) {
        s += iterator.next() + " ";
    }/*from  w  w w.  j  av a 2 s  .co  m*/
    s += "] ";
    return "(" + name + ", " + s + " size: " + size() + ")";
}