Example usage for java.util Collections addAll

List of usage examples for java.util Collections addAll

Introduction

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

Prototype

@SafeVarargs
public static <T> boolean addAll(Collection<? super T> c, T... elements) 

Source Link

Document

Adds all of the specified elements to the specified collection.

Usage

From source file:org.infinitest.eclipse.workspace.EclipseWorkspace.java

@Autowired
public void addStatusListeners(WorkspaceStatusListener... listeners) {
    Collections.addAll(statusListeners, listeners);
}

From source file:com.verigreen.common.spring.SpringContextLoader.java

private String[] generateConfigLocations(List<String> additionalLocations) {

    String[] ecLocations = getLocationsToLoad();

    int size = ecLocations.length + additionalLocations.size();
    ArrayList<String> newLocations = new ArrayList<>(size);
    Collections.addAll(newLocations, ecLocations);

    // this line needs to be at the end so that any mock contexts will override normal contexts
    newLocations.addAll(additionalLocations);

    return newLocations.toArray(new String[size]);
}

From source file:capital.scalable.restdocs.constraints.ConstraintAndGroupDescriptionResolver.java

@Override
public List<Class> getGroups(Constraint constraint) {
    Object rawGroups = constraint.getConfiguration().get(GROUPS);
    if (!(rawGroups instanceof Class[])) {
        return emptyList();
    }/*from   w w  w . java 2 s. co  m*/
    Class[] groups = (Class[]) rawGroups;

    List<Class> result = new ArrayList<>();
    Collections.addAll(result, groups);
    return result;
}

From source file:com.apporiented.hermesftp.PluginManager.java

private static File[] collectJars(String[] paths) {
    Set<File> jarList = new HashSet<File>();
    for (String path : paths) {
        File dir = new File(path);
        if (log.isWarnEnabled() && !dir.exists()) {
            log.warn("JAR folder not found: " + dir);
        }/*from   www. ja va 2  s.c o  m*/
        if (dir.exists() && dir.isDirectory()) {
            File[] files = dir.listFiles(new JarFileFilter());
            Collections.addAll(jarList, files);
        }
    }
    return jarList.toArray(new File[jarList.size()]);
}

From source file:com.asakusafw.testdriver.compiler.util.DeploymentUtil.java

/**
 * Deletes the target file/directory./*w  ww . j a v a 2  s .  c om*/
 * @param target the target file/directory
 * @param options the operation options
 * @return {@code true} if the target file/directory was successfully deleted (or does not exist initially),
 *     otherwise {@code false}
 * @throws IOException if I/O error was occurred
 */
public static boolean delete(File target, DeleteOption... options) throws IOException {
    if (target.exists() == false) {
        return true;
    }
    Set<DeleteOption> opts = EnumSet.noneOf(DeleteOption.class);
    Collections.addAll(opts, options);
    if (opts.contains(DeleteOption.QUIET)) {
        return FileUtils.deleteQuietly(target);
    } else {
        FileUtils.forceDelete(target);
        return true;
    }
}

From source file:mbenson.annotationprocessing.util.LangModel.java

/**
 * Filter {@link Element}s that match a set of modifiers.
 * /*from w  w w . j av a2  s .  co m*/
 * @param elements
 * @param modifiers
 * @return Iterable<T>
 */
public static <T extends Element> Iterable<T> filterByModifier(Iterable<T> elements, Modifier... modifiers) {
    final Set<Modifier> modifierSet;
    if (modifiers != null && modifiers.length > 0) {
        modifierSet = new HashSet<Modifier>();
    } else {
        modifierSet = Collections.emptySet();
    }

    Collections.addAll(modifierSet, modifiers);

    ArrayList<T> result = new ArrayList<T>();
    for (T element : elements) {
        if (element.getModifiers().containsAll(modifierSet)) {
            result.add(element);
        }
    }
    return result;
}

From source file:co.marcin.novaguilds.util.StringUtils.java

public static List<String> semicolonToList(String str) {
    List<String> list = new ArrayList<>();

    if (str.contains(";")) {
        String[] split = str.split(";");
        Collections.addAll(list, split);
    } else if (!str.isEmpty()) {
        list.add(str);/*from   w  ww.ja v  a  2 s  . co  m*/
    }

    return list;
}

From source file:com.silverpeas.form.form.XmlSearchForm.java

public XmlSearchForm(RecordTemplate template) throws FormException {
    super(template);
    if (template != null) {
        Collections.addAll(this.fieldTemplates, template.getFieldTemplates());
    }/*from  w  ww  .  j  av a2 s .  c om*/
}

From source file:it.unibz.instasearch.ui.InstaSearchPage.java

public boolean performAction() {
    HashMap<Field, Set<String>> filter = new HashMap<Field, Set<String>>();

    if (container.getSelectedScope() == ISearchPageContainer.SELECTED_PROJECTS_SCOPE
            && container.getSelectedProjectNames().length != 0) // projects
    {/*from  w  w w .  ja v  a2  s. co  m*/
        TreeSet<String> selectedProjects = new TreeSet<String>();
        Collections.addAll(selectedProjects, container.getSelectedProjectNames());
        filter.put(Field.PROJ, selectedProjects);

    } else if (container.getSelectedScope() == ISearchPageContainer.WORKING_SET_SCOPE
            && container.getSelectedWorkingSets().length != 0) { // working sets

        filter.put(Field.WS, getWorkingSetSearchString());

    } else if (container.getSelectedScope() == ISearchPageContainer.SELECTION_SCOPE
            && !container.getSelection().isEmpty()) {
        getSelectedResources(filter);
    }

    filter.put(Field.EXT, getSelectedExtensions());
    extensionEditor.store();

    String searchString = searchText.getText();

    InstaSearchView searchView = InstaSearchUI.showSearchView();

    if (searchView != null) {
        int maxResults = SearchQuery.UNLIMITED_RESULTS;
        searchString += convertFilterToString(filter);
        SearchQuery searchQuery = new SearchQuery(searchString, maxResults);
        searchQuery.setExact(similarSearch.getSelection());
        searchQuery.setFilter(null); // put filters in search string instead

        searchView.setSearchString(searchString); // to display
        searchView.search(searchQuery, false);
    }

    return true;
}

From source file:de.hska.ld.core.config.CoreBootstrap.java

private Collection<Role> convertToRoleList(Role... roles) {
    Collection<Role> roleList = new ArrayList<>();
    Collections.addAll(roleList, roles);
    return roleList;
}