Example usage for java.util ListIterator set

List of usage examples for java.util ListIterator set

Introduction

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

Prototype

void set(E e);

Source Link

Document

Replaces the last element returned by #next or #previous with the specified element (optional operation).

Usage

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 a va  2  s  . c  om*/

    return filenames;
}

From source file:org.jcodec.containers.mp4.boxes.MovieBox.java

public void fixTimescale(int newTs) {
    int oldTs = getTimescale();
    setTimescale(newTs);//from  w  ww .  jav  a 2 s  .c  o  m

    for (TrakBox trakBox : getTracks()) {
        trakBox.setDuration(rescale(trakBox.getDuration(), oldTs));

        List<Edit> edits = trakBox.getEdits();
        if (edits == null)
            continue;
        ListIterator<Edit> lit = edits.listIterator();
        while (lit.hasNext()) {
            Edit edit = lit.next();
            lit.set(new Edit(rescale(edit.getDuration(), oldTs), edit.getMediaTime(), edit.getRate()));
        }
    }

    setDuration(rescale(getDuration(), oldTs));
}

From source file:org.xbmc.android.jsonrpc.generator.model.Namespace.java

/**
 * Goes through all classes in the namespace and resolves them.
 *///from   ww w . j  a va  2  s.com
public void resolveChildren() {

    // classes
    final ListIterator<JavaClass> classIterator = classes.listIterator();
    while (classIterator.hasNext()) {
        classIterator.set(JavaClass.resolveNonNull(classIterator.next()));
    }

    // enums
    final ListIterator<JavaEnum> enumIterator = enums.listIterator();
    while (enumIterator.hasNext()) {
        enumIterator.set(JavaEnum.resolve(enumIterator.next()));
    }
}

From source file:org.opencms.util.CmsFileUtil.java

/**
 * Checks if all resources are present.<p>
 *
 * @param cms an initialized OpenCms user context which must have read access to all resources
 * @param resources a list of vfs resource names to check
 *
 * @throws CmsIllegalArgumentException in case not all resources exist or can be read with the given OpenCms user context
 *///from w  w  w  .j  ava2 s  .  c  o m
public static void checkResources(CmsObject cms, List<String> resources) throws CmsIllegalArgumentException {

    StringBuffer result = new StringBuffer(128);
    ListIterator<String> it = resources.listIterator();
    while (it.hasNext()) {
        String resourcePath = it.next();
        try {
            CmsResource resource = cms.readResource(resourcePath);
            // append folder separator, if resource is a folder and does not and with a slash
            if (resource.isFolder() && !resourcePath.endsWith("/")) {
                it.set(resourcePath + "/");
            }
        } catch (@SuppressWarnings("unused") CmsException e) {
            result.append(resourcePath);
            result.append('\n');
        }
    }
    if (result.length() > 0) {
        throw new CmsIllegalArgumentException(
                Messages.get().container(Messages.ERR_MISSING_RESOURCES_1, result.toString()));
    }
}

From source file:net.alchemiestick.katana.winehqappdb.filter_dialog.java

private void setNamedData(String name, String value) {
    ListIterator<NameValuePair> itr = webData.listIterator();
    while (itr.hasNext()) {
        NameValuePair t = itr.next();
        if (t.getName() == name) {
            itr.set(new BasicNameValuePair(name, value));
            return;
        }//from ww w . j  a v  a2  s.c  o  m
    }
    webData.add(new BasicNameValuePair(name, value));
}

From source file:net.xy.jcms.portal.controller.StaticsInclusion.java

/**
 * proccesses the instructionset//ww  w . j  a  va2s.  co m
 * 
 * @param configK
 * @param configC
 */
@SuppressWarnings("unchecked")
private void proccess(final Config config, final ContentRepository configC, final Model configuration,
        final IDataAccessContext dac) {
    final Map<String, Object> aggregatedContent = new HashMap<String, Object>();
    if (config.getGlobal(INSTRUCTION_SECTION) instanceof List) {
        for (final Map<Object, String> instruction : (List<Map<Object, String>>) config
                .getGlobal(INSTRUCTION_SECTION)) {
            // get domain in case of one exists
            final String domain = config.get(DOMAIN, instruction);
            // get path prefix
            final String prefix;
            if (domain != null) {
                prefix = domain + config.get(PREFIX, instruction);
            } else {
                prefix = config.get(PREFIX, instruction);
            }
            // get type
            final String type = config.get(TYPE, instruction);

            Object finalContent = null;
            final Object firstContent = instruction.get("content");
            if (String.class.isInstance(firstContent)) {
                final String strContent = (String) firstContent;
                // get content in right object
                if ("StringList".equalsIgnoreCase(type)) {
                    // get url list
                    final StringList contentList = new StringList(strContent);
                    // prefix if configured
                    if (StringUtils.isNotBlank(prefix)) {
                        final ListIterator<String> it = contentList.listIterator();
                        while (it.hasNext()) {
                            final String content = it.next();
                            it.set(prefix + content.trim());
                        }
                    }
                    finalContent = contentList;
                } else if ("StringMap".equalsIgnoreCase(type)) {
                    finalContent = new StringMap(strContent);
                } else if ("String".equalsIgnoreCase(type)) {
                    finalContent = prefix + strContent;
                } else {
                    // call abstract
                    finalContent = processType(type, instruction, config, prefix, dac);
                }
            } else {
                finalContent = firstContent;
            }

            // put in targets
            if (finalContent != null) {
                for (final String target : new StringList(instruction.get("target"))) {
                    aggregatedContent.put(target, finalContent);
                }
            }
        }
    }
    configuration.put(ContentRepository.TYPE, configC.mergeConfiguration(aggregatedContent));
}

From source file:org.openhab.tools.analysis.checkstyle.BuildPropertiesCheck.java

private void removeSubstringAtEnd(List<String> values, String substr) {
    ListIterator<String> iterator = values.listIterator();
    while (iterator.hasNext()) {
        String value = iterator.next();
        if (value.endsWith(substr)) {
            iterator.set(value.substring(0, value.length() - 1));
        }/* w w w  .ja  v  a2 s.co  m*/
    }
}

From source file:com.cburch.draw.tools.DrawingAttributeSet.java

public <V> void setValue(Attribute<V> attr, V value) {
    Iterator<Attribute<?>> ait = attrs.iterator();
    ListIterator<Object> vit = values.listIterator();
    while (ait.hasNext()) {
        Object a = ait.next();//w  ww.  ja v a  2  s.c om
        vit.next();
        if (a.equals(attr)) {
            vit.set(value);
            AttributeEvent e = new AttributeEvent(this, attr, value);
            for (AttributeListener listener : listeners) {
                listener.attributeValueChanged(e);
            }
            if (attr == DrawAttr.PAINT_TYPE) {
                e = new AttributeEvent(this);
                for (AttributeListener listener : listeners) {
                    listener.attributeListChanged(e);
                }
            }
            return;
        }
    }
    throw new IllegalArgumentException(attr.toString());
}

From source file:edu.harvard.i2b2.pm.util.PMUtil.java

public void convertToUppercaseStrings(List<String> list) {
    ListIterator<String> iterator = list.listIterator();

    while (iterator.hasNext()) {
        String color = iterator.next(); // get item                 
        iterator.set(color.toUpperCase()); // convert to upper case
    } // end while
}

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();/*ww w .  j  ava  2 s .c o  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);
}