Example usage for org.apache.commons.collections CollectionUtils addAll

List of usage examples for org.apache.commons.collections CollectionUtils addAll

Introduction

In this page you can find the example usage for org.apache.commons.collections CollectionUtils addAll.

Prototype

public static void addAll(Collection collection, Object[] elements) 

Source Link

Document

Adds all elements in the array to the given collection.

Usage

From source file:de.inren.service.comment.CommentServiceImpl.java

@Override
public List<Comment> loadAllComments() {
    List<Comment> res = new ArrayList<Comment>();
    CollectionUtils.addAll(res, commentRepository.findAll().iterator());
    return res;//  www  . ja v a  2 s.  com
}

From source file:com.cyclopsgroup.waterview.servlet.ServletRequestParameters.java

/**
 * Override method doGetAttributeNames in class ServletRequestValueParser
 *
 * @see com.cyclopsgroup.waterview.Attributes#doGetAttributeNames()
 *///  w w  w  . j ava2 s. co m
protected String[] doGetAttributeNames() {
    HashSet names = new HashSet();
    CollectionUtils.addAll(names, httpServletRequest.getParameterNames());
    names.addAll(extra.keySet());
    return (String[]) names.toArray(ArrayUtils.EMPTY_STRING_ARRAY);
}

From source file:de.inren.service.blogpost.BlogPostServiceImpl.java

@Override
public List<BlogPost> loadAllBlogPosts() {
    List<BlogPost> res = new ArrayList<BlogPost>();
    CollectionUtils.addAll(res, blogPostRepository.findAll().iterator());
    return res;/*  w  w  w  .j  a  v  a2 s  . com*/
}

From source file:com.cyclopsgroup.waterview.velocity.VelocityJellyContextAdapter.java

/**
 * Overwrite or implement method getKeys()
 *
 * @see org.apache.velocity.context.Context#getKeys()
 *//*  www.  j ava2 s  .c  om*/
public Object[] getKeys() {
    HashSet keys = new HashSet();
    CollectionUtils.addAll(keys, context.getVariableNames());
    return keys.toArray();
}

From source file:com.bstek.dorado.core.SpringApplicationContext.java

private Resource[] getConfigLocations(String configLocation) throws IOException {
    Set<Resource> resourceSet = new LinkedHashSet<Resource>();

    String[] configLocations = StringUtils.split(configLocation, LOCATION_SEPARATOR);
    for (String location : configLocations) {
        if (StringUtils.isNotBlank(location)) {
            CollectionUtils.addAll(resourceSet, getResources(location));
        }/* w  ww.j  av a  2 s.  c  om*/
    }

    for (Iterator<Resource> it = resourceSet.iterator(); it.hasNext();) {
        Resource resource = it.next();
        if (!resource.exists()) {
            logger.warn("Resource [" + resource + "] does not exist.");
            it.remove();
        }
    }

    Resource[] resources = new Resource[resourceSet.size()];
    resourceSet.toArray(resources);
    return resources;
}

From source file:com.cyclopsgroup.waterview.velocity.VelocityContextAdapter.java

/**
 * Override or implement method of parent class or interface
 *
 * @see org.apache.velocity.context.Context#getKeys()
 *//*from w w w  . j a v  a  2 s  . co  m*/
public Object[] getKeys() {
    List keys = new ArrayList();
    CollectionUtils.addAll(keys, context.keys());
    return keys.toArray();
}

From source file:com.haulmont.chile.core.loader.ChileMetadataLoader.java

protected void initMetaClass(MetaClass metaClass) {
    for (MetaProperty property : metaClass.getOwnProperties()) {
        initMetaProperty(metaClass, property);
    }/*from w w w  . j  a va 2 s .co m*/

    Collection<MetaClass> missingDescendants = new HashSet<>(1);

    findMissingDescendants(metaClass, missingDescendants);

    if (!missingDescendants.isEmpty()) {
        CollectionUtils.addAll(metaClass.getDescendants(), missingDescendants.iterator());

        MetaClass ancestorMetaClass = metaClass.getAncestor();
        while (ancestorMetaClass != null) {
            CollectionUtils.addAll(ancestorMetaClass.getDescendants(), missingDescendants.iterator());
            ancestorMetaClass = ancestorMetaClass.getAncestor();
        }
    }

    MetaClass ancestorMetaClass = metaClass.getAncestor();
    while (ancestorMetaClass != null) {
        ((MetaClassImpl) metaClass).addAncestor(ancestorMetaClass);
        ancestorMetaClass = ancestorMetaClass.getAncestor();
    }
}

From source file:br.ufrj.nce.recureco.distributedindex.search.service.SearchService.java

public List<String> getDocuments(String query, boolean booleanOr) {

    List<String> andWords = lineTokenizer.tokenize(query);

    //if query words list is null, return empty results
    if (andWords == null) {
        return new ArrayList<String>();
    }//from  w  ww.j a  v  a 2  s  .c  o  m
    //if query words list is  empty, return empty results
    if (andWords.size() == 0) {
        return new ArrayList<String>();
    }

    //if still here, there is something to search
    List<String> results = searchDAO.getDocuments(andWords);

    List<String> documentsResults = new ArrayList<String>();

    boolean firstTime = true;

    for (String docs : results) {

        List<String> auxList = new ArrayList<String>();
        CollectionUtils.addAll(auxList, docs.split(","));

        if (booleanOr) {
            documentsResults = ListUtils.sum(documentsResults, auxList);
        } else {
            if (firstTime) {
                documentsResults = ListUtils.union(documentsResults, auxList);
                firstTime = false;
            } else {
                documentsResults = ListUtils.intersection(documentsResults, auxList);
            }
        }
    }

    return documentsResults;
}

From source file:com.google.gdt.eclipse.designer.hosted.tdt.Activator.java

/**
 * Return array of entry sub-paths in given path.
 *///from w  w  w.  j  a v  a  2  s .co  m
public static String[] getEntriesPaths(String path) {
    List<String> entryPaths;
    {
        Enumeration<?> entryPathsEnumeration = m_plugin.getBundle().getEntryPaths(path);
        entryPaths = new ArrayList<String>();
        CollectionUtils.addAll(entryPaths, entryPathsEnumeration);
    }
    // remove "CVS" files (far case when we use runtime workbench)
    for (Iterator<String> I = entryPaths.iterator(); I.hasNext();) {
        String entryPath = I.next();
        if (entryPath.indexOf("CVS") != -1) {
            I.remove();
        }
    }
    // convert to array
    return entryPaths.toArray(new String[entryPaths.size()]);
}

From source file:com.cyclopsgroup.waterview.impl.servlet.ServletRequestParameters.java

/**
 * Override method doGetAttributeNames in class ServletRequestValueParser
 *
 * @see com.cyclopsgroup.waterview.Attributes#doGetAttributeNames()
 *///from ww w .  ja  va  2s.  c om
@Override
protected Set<String> doGetAttributeNames() {
    HashSet<String> names = new HashSet<String>();
    CollectionUtils.addAll(names, httpServletRequest.getParameterNames());
    if (!extra.isEmpty()) {
        names.addAll(extra.keySet());
    }
    return names;
}