Example usage for java.util Collection addAll

List of usage examples for java.util Collection addAll

Introduction

In this page you can find the example usage for java.util Collection addAll.

Prototype

boolean addAll(Collection<? extends E> c);

Source Link

Document

Adds all of the elements in the specified collection to this collection (optional operation).

Usage

From source file:edu.uci.ics.jung.graph.OrderedSparseMultigraph.java

@Override
public Collection<V> getNeighbors(V vertex) {
    if (!containsVertex(vertex))
        return null;

    Collection<V> out = new LinkedHashSet<V>();
    out.addAll(this.getPredecessors(vertex));
    out.addAll(this.getSuccessors(vertex));
    return out;//from  w w  w  .j av a2 s .co  m
}

From source file:edu.uci.ics.jung.graph.OrderedSparseMultigraph.java

@Override
public Collection<E> getIncidentEdges(V vertex) {
    if (!containsVertex(vertex))
        return null;

    Collection<E> out = new LinkedHashSet<E>();
    out.addAll(this.getInEdges(vertex));
    out.addAll(this.getOutEdges(vertex));
    return out;//  ww w.  j a  v a  2 s .c  o m
}

From source file:org.jasig.portlet.weather.servlet.FindCityController.java

@RequestMapping("/findCity")
public ModelAndView findCity(@RequestParam("location") String location, HttpServletRequest request,
        HttpServletResponse response) {/*from  w w  w  . j a va2 s. c o  m*/

    final Map<String, Object> model = new LinkedHashMap<String, Object>();
    final Collection<Location> locations = new ArrayList<Location>();

    try {
        locations.addAll(this.weatherService.find(location));
    } catch (InvalidConfigurationException invalidConfigurationException) {
        model.put("error", invalidConfigurationException.getMessage());
    } catch (DataRetrievalFailureException dataRetrievalFailed) {
        model.put("error", messageSource.getMessage(ERR_GENERAL_KEY, null, "An unexpected error occurred.",
                Locale.getDefault()));
    }

    model.put("locations", locations);
    return new ModelAndView("jsonView", model);
}

From source file:com.datos.vfs.provider.ftp.FtpFileSystem.java

/**
 * Adds the capabilities of this file system.
 *///from   w w  w  . j a va2s  . c  o m
@Override
protected void addCapabilities(final Collection<Capability> caps) {
    caps.addAll(FtpFileProvider.capabilities);
}

From source file:com.joshlong.lazyblogger.model.BlogPost.java

public Collection<String> getSenders() {
    Collection<String> newSenders = new HashSet<String>();
    newSenders.addAll(this.senders);
    return newSenders;
}

From source file:ws.moor.bt.gui.charts.TotalBlocksPerPeer.java

private DefaultCategoryDataset createDataset() {
    DefaultCategoryDataset dataset = new DefaultCategoryDataset();

    Map<Long, String> rateToKey = new TreeMap<Long, String>();
    Collection<String> keys = new HashSet<String>();
    keys.addAll(counterRepository.getKeys("torrent.blocks.leecher"));
    keys.addAll(counterRepository.getKeys("torrent.blocks.seed"));
    for (String key : keys) {
        CounterStatistics leechStats = counterRepository.getStatistics("torrent.blocks.leecher", key);
        CounterStatistics seedStats = counterRepository.getStatistics("torrent.blocks.seed", key);

        long blocks = leechStats.latestValue() + seedStats.latestValue();
        rateToKey.put(-blocks, key);//from  w ww  .j a v  a  2  s  . c o m
    }

    for (String key : rateToKey.values()) {
        CounterStatistics leechStats = counterRepository.getStatistics("torrent.blocks.leecher", key);
        CounterStatistics seedStats = counterRepository.getStatistics("torrent.blocks.seed", key);

        dataset.addValue(seedStats.latestValue(), "seed", key);
        dataset.addValue(leechStats.latestValue(), "leecher", key);
        if (dataset.getColumnCount() >= 20) {
            break;
        }
    }

    return dataset;
}

From source file:org.ff4j.services.GroupServices.java

public Collection<FeatureApiBean> getFeaturesByGroup(String groupName) {
    featureValidator.assertGroupExist(groupName);
    Collection<Feature> features = ff4j.getFeatureStore().readGroup(groupName).values();
    Collection<FeatureApiBean> featureApiBeans = new ArrayList<>();
    if (!CollectionUtils.isEmpty(features)) {
        featureApiBeans.addAll(features.stream().map(FeatureApiBean::new).collect(Collectors.toList()));
    }/*from  w w  w  .  j a v a  2s.  c om*/
    return featureApiBeans;
}

From source file:ru.asmsoft.p2p.storage.MemoryMessageRepository.java

@Override
public void syncDb(long dbVersion, Collection<P2PMessage> messages) {
    messages.clear();// ww w.  j av a 2s  .  c o  m
    messages.addAll(messages);
    version = dbVersion;
}

From source file:com.github.stephenc.javaisotools.vfs.provider.iso.IsoFileSystem.java

protected void addCapabilities(final Collection caps) {
    caps.addAll(IsoFileProvider.capabilities);
}

From source file:graph.module.SemanticSimilarityModule.java

public Collection<Node> getParents(Node node) {
    Collection<Node> parents = new HashSet<Node>(CommonQuery.ALLISA.runQuery(dag_, node));
    parents.addAll(CommonQuery.ALLGENLS.runQuery(dag_, node));
    return parents;
}