Example usage for java.util List clear

List of usage examples for java.util List clear

Introduction

In this page you can find the example usage for java.util List clear.

Prototype

void clear();

Source Link

Document

Removes all of the elements from this list (optional operation).

Usage

From source file:org.matsim.contrib.analysis.christoph.ActivitiesAnalyzer.java

@Override
public void reset(final int iter) {
    for (List<ActivityData> list : this.activityCountData.values()) {
        list.clear();
        list.add(new ActivityData(0.0, 0));
    }//from  w ww .j  a v a  2  s .  c o m
    this.overallCount.clear();
    this.overallCount.add(new ActivityData(0.0, 0));
}

From source file:com.ning.metrics.collector.processing.db.TestFeedEventStorage.java

@Test
public void testInsertFeedEvents() throws Exception {

    List<FeedEvent> feedEvents = Lists.newArrayList();

    for (int i = 0; i < 10; i++) {
        feedEvents.add(getFeedEvent(subscription, eventData));
    }/*  ww w. ja v  a 2  s .c  o  m*/

    List<String> idList = feedEventStorage.insert(feedEvents);

    feedEvents.clear();
    Assert.assertTrue(feedEvents.isEmpty());

    feedEvents = feedEventStorage.load(channel, idList, 10);

    Assert.assertTrue(feedEvents.size() == 10);
    Assert.assertEquals(feedEvents.get(0).getChannel(), channel);
    Assert.assertEquals(feedEvents.get(0).getMetadata().getFeed(), feed);
    Assert.assertEquals(feedEvents.get(0).getSubscriptionId(), subscription.getId());
    Assert.assertEquals(feedEvents.get(0).getEvent().getRollupKeepLast(), 10);

}

From source file:com.ephesoft.gxt.home.server.BatchListServiceImpl.java

private List<BatchPriority> getPriorityList(final List<DataFilter> filters) {

    List<BatchPriority> batchPriorities = new ArrayList<BatchPriority>();
    batchPriorities.clear();
    if (!filters.isEmpty()) {
        for (DataFilter filter : filters) {
            if ((BatchListConstants.PRIORITY).equals(filter.getColumn())) {
                batchPriorities.add(getPriorityValue(filter));
            }/*from  w  ww .  j a v  a2s  .  c  o m*/
        }
    }
    return batchPriorities;
}

From source file:com.msopentech.odatajclient.engine.data.impl.AbstractEntry.java

@SuppressWarnings("unchecked")
private void setLinks(final List<LINK> links, final List<Link> linkResources) {
    links.clear();
    for (Link link : linkResources) {
        links.add((LINK) link);//from  ww  w . j  a  va2 s  .  co m
    }
}

From source file:blusunrize.immersiveengineering.client.render.ItemRendererIEOBJ.java

private void renderQuadsForGroups(String[] groups, IOBJModelCallback<ItemStack> callback, IESmartObjModel model,
        List<Pair<BakedQuad, ShaderLayer>> quadsForGroup, ItemStack stack, ShaderCase sCase, ItemStack shader,
        BufferBuilder bb, Tessellator tes, Map<String, Boolean> visible, float partialTicks) {
    quadsForGroup.clear();
    for (String g : groups) {
        if (visible.getOrDefault(g, Boolean.FALSE) && callback.shouldRenderGroup(stack, g))
            quadsForGroup.addAll(model.addQuadsForGroup(callback, stack, g, sCase, shader).stream()
                    .filter(Objects::nonNull).collect(Collectors.toList()));
        visible.remove(g);/*from  ww  w  . j  a va  2  s  .  c om*/
    }
    if (!callback.areGroupsFullbright(stack, groups))
        bb.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
    else
        bb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
    VertexBufferConsumer vbc = new VertexBufferConsumer(bb);
    ShaderLayer lastShaderLayer = null;
    for (Pair<BakedQuad, ShaderLayer> pair : quadsForGroup) {
        BakedQuad bq = pair.getKey();
        ShaderLayer layer = pair.getValue();
        //Switch to or between dynamic layers
        boolean switchDynamic = layer != lastShaderLayer;
        if (switchDynamic) {
            //interrupt batch
            tes.draw();

            if (lastShaderLayer != null)//finish dynamic call on last layer
                lastShaderLayer.modifyRender(false, partialTicks);

            //set new layer
            lastShaderLayer = layer;

            if (lastShaderLayer != null)//start dynamic call on layer
                lastShaderLayer.modifyRender(true, partialTicks);
            //start new batch
            if (!callback.areGroupsFullbright(stack, groups))
                bb.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
            else
                bb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);

        }
        bq.pipe(vbc);
    }
    tes.draw();
    if (lastShaderLayer != null)//finish dynamic call on final layer
        lastShaderLayer.modifyRender(false, partialTicks);

}

From source file:it.greenvulcano.gvesb.adapter.http.MultiReadHttpServletResponse.java

private void setHeaderLoc(String name, String value) {
    List<String> values = headers.get(name);
    if (values == null) {
        values = new ArrayList<String>();
        headers.put(name, values);//from w  w w  .  j av a 2s  . c om
    } else {
        values.clear();
    }
    values.add(value);
}

From source file:mitm.common.extractor.impl.UnicodeTextExtractorTest.java

private void closeInputStreams(List<RewindableInputStream> streams) throws IOException {
    for (RewindableInputStream stream : streams) {
        IOUtils.closeQuietly(stream);//from  w w w . j  a  v a 2 s. c  o  m
    }

    streams.clear();
}

From source file:name.livitski.tools.springlet.commands.HelpCommand.java

/**
 * Displays the application's usage summary obtained by polling all
 * {@link Command command beans} defined in its configuration.
 *//* w w  w  .  j a v a  2  s.  c  o  m*/
public void usage() {
    System.out.println("Usage summary:");
    System.out.printf(" java -cp {classpath} [vm-args] run [args]%n%n");
    System.out.println(" where: args := arg [args] ;");
    System.out.println("  arg is one of the following:");
    Map<String, Command> commands = beanFactory.getBeansOfType(Command.class);
    StringBuilder tagSpec = new StringBuilder(512);
    List<String> cmdsTags = new ArrayList<String>();
    for (final Map.Entry<String, Command> entry : commands.entrySet()) {
        final Command cmd = entry.getValue();
        final String id = entry.getKey();
        tagSpec.setLength(0);
        cmdsTags.clear();
        cmdsTags.add(id);
        final String[] aliases = beanFactory.getAliases(id);
        for (String alias : aliases)
            cmdsTags.add(alias);
        for (String tag : cmdsTags) {
            if (tag.startsWith(Launcher.BEAN_NAME_PREFIX_COMMAND))
                tag = COMMAND_PREFIX + tag.substring(Launcher.BEAN_NAME_PREFIX_COMMAND.length());
            else if (tag.startsWith(Launcher.BEAN_NAME_PREFIX_SWITCH))
                tag = SWITCH_PREFIX + tag.substring(Launcher.BEAN_NAME_PREFIX_SWITCH.length());
            else if (tag.equals(Launcher.BEAN_NAME_DEFAULT_HANDLER))
                continue;
            if (0 != tagSpec.length())
                tagSpec.append(", ");
            tagSpec.append(tag);
        }
        String argspec = cmd.getArgSpec();
        System.out.printf("%n %s%s%n", tagSpec, null == argspec ? "" : " " + argspec);
        System.out.printf("%n   %s%n", cmd.getSummary());
    }
    System.out.println();
}

From source file:eu.uqasar.web.dashboard.widget.datadeviation.DataDeviationSettingsPanel.java

/**
 * /*www.j a  v a  2s.  com*/
 * @param list
 * @return
 */
private List<String> removeDuplicates(List<String> list) {
    Set<String> set = new LinkedHashSet<>(list);
    list.clear();
    list.addAll(set);
    return list;
}

From source file:de.blizzy.documentr.markdown.MarkdownProcessor.java

private void extractHeader(RootNode rootNode) {
    List<Node> children = rootNode.getChildren();
    PageHeaderNode headerNode = findHeaderNode(rootNode);
    children.clear();
    if (headerNode != null) {
        children.addAll(headerNode.getChildren());
    }/*  ww  w. jav  a 2 s.com*/
}