Example usage for java.util Set addAll

List of usage examples for java.util Set addAll

Introduction

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

Prototype

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

Source Link

Document

Adds all of the elements in the specified collection to this set if they're not already present (optional operation).

Usage

From source file:com.hmsinc.epicenter.classifier.util.ClassifierUtils.java

private static Set<String> makeStopSet(String... words) {
    final Set<String> stopSet = new HashSet<String>();
    stopSet.addAll(Arrays.asList(words));
    return Collections.unmodifiableSet(stopSet);
}

From source file:com.docd.purefm.utils.BookmarksHelper.java

@NonNull
public static Set<String> getAllLocations(@NonNull final Context context) {
    final Set<String> result = new TreeSet<>();
    result.addAll(BookmarksHelper.getStorageBookmarks());
    result.addAll(Settings.getInstance(context).getBookmarks());
    return result;
}

From source file:net.sf.morph.util.ContainerUtils.java

/**
 * Returns the intersection of multiple arrays as an array.  Implementation is O(n<sup>3</sup>).
 *
 * @param arrays//from www . j a va  2  s  .c  o  m
 *            a List of arrays
 * @param componentType
 *            the runtime type of the returned array
 * @return the intersection of the arrays
 */
public static Object[] intersection(List arrays, Class componentType) {
    if (componentType == null) {
        throw new IllegalArgumentException("componentType must be speciifed");
    }
    if (arrays == null) {
        return null;
    }

    Set intersectionSet = new HashSet();
    intersectionSet.addAll(Arrays.asList(((Object[]) arrays.get(0))));
    for (int i = 1; i < arrays.size(); i++) {
        Object[] array = (Object[]) arrays.get(i);
        for (int j = 0; j < array.length; j++) {
            if (!contains(intersectionSet, array[j])) {
                intersectionSet.remove(array[j]);
            }
        }
    }

    Object[] intersectionArray = (Object[]) ClassUtils.createArray(componentType, intersectionSet.size());
    return intersectionSet.toArray(intersectionArray);
}

From source file:com.qwazr.QwazrConfiguration.java

private static Set<ServiceEnum> buildServices(Collection<ServiceEnum> serviceCollection) {
    if (serviceCollection == null)
        return null;
    Set<ServiceEnum> services = new HashSet<>();
    services.addAll(serviceCollection);
    return services;
}

From source file:eu.skillpro.ams.pscm.connector.amsservice.ui.SendExecutableSkillToServer.java

public static String convertExecutableSkillToAML(ExecutableSkill skill)
        throws TransformerException, IOException {
    ReverseTransformer.getInstance().reverseTransformExecutableSkill(skill);
    Collection<Object> values = AMLTransformationService.getTransformationProvider().getTransformationRepo()
            .getReverseTransformedObjectsMap().values();
    Set<Object> objects = new HashSet<>();
    objects.addAll(values);
    Document exportedAsDoc = AMLExporter.getExportedAsDoc(objects, true);
    exportedAsDoc = AMLExporter.getInternalElementsOnly(exportedAsDoc);
    return AMLExporter.getExportedAsString(exportedAsDoc);
}

From source file:eu.skillpro.ams.pscm.connector.amsservice.ui.SendExecutableSkillToServer.java

public static String convertResourceExecutableSkillToAML(ResourceExecutableSkill skill)
        throws TransformerException, IOException {
    ReverseTransformer.getInstance().reverseTransformResourceExecutableSkill(skill);
    Collection<Object> values = AMLTransformationService.getTransformationProvider().getTransformationRepo()
            .getReverseTransformedObjectsMap().values();
    Set<Object> objects = new HashSet<>();
    objects.addAll(values);
    Document exportedAsDoc = AMLExporter.getExportedAsDoc(objects, true);
    exportedAsDoc = AMLExporter.getInternalElementsOnly(exportedAsDoc);
    return AMLExporter.getExportedAsString(exportedAsDoc);
}

From source file:net.nifheim.beelzebu.coins.common.utils.dependencies.DependencyManager.java

public static void loadAllDependencies() {
    Set<Dependency> dependencies = new LinkedHashSet<>();
    dependencies.addAll(Arrays.asList(Dependency.values()));
    if (classExists("org.sqlite.JDBC") || core.isBungee()) {
        dependencies.remove(Dependency.SQLITE_DRIVER);
    }// w ww .  ja va2  s.  co  m
    if (classExists("com.mysql.jdbc.Driver")) {
        dependencies.remove(Dependency.MYSQL_DRIVER);
    }
    if (classExists("org.slf4j.Logger") && classExists("org.slf4j.LoggerFactory")) {
        dependencies.remove(Dependency.SLF4J_API);
        dependencies.remove(Dependency.SLF4J_SIMPLE);
    }
    if (classExists("org.apache.commons.io.FileUtils")) {
        dependencies.remove(Dependency.COMMONS_IO);
    }
    if (!dependencies.isEmpty()) {
        loadDependencies(dependencies);
    }
}

From source file:com.devnexus.ting.config.PersistenceConfig.java

public static Class<?>[] getAnnotatedPersistenceClasses() {
    Reflections reflections = new Reflections(PERSISTENCE_BASE_PACKAGE);
    Set<Class<?>> entityClasses = reflections.getTypesAnnotatedWith(Entity.class);
    entityClasses.addAll(reflections.getTypesAnnotatedWith(MappedSuperclass.class));
    return entityClasses.toArray(new Class<?>[0]);
}

From source file:com.github.blindpirate.gogradle.common.GoSourceCodeFilter.java

public static Collection<File> filterGoFiles(File projectDir, SourceSetType sourceSetType) {
    Collection<File> projectGoFiles = filterProjectGoFiles(projectDir, sourceSetType);
    if (sourceSetType.containsVendorBuildFiles && isValidDirectory(new File(projectDir, VENDOR_DIRECTORY))) {
        Set<File> result = new HashSet<>(projectGoFiles);
        result.addAll(filterVendorGoFiles(projectDir));
        return result;
    } else {/*from  w  ww.ja  va2s  .c o  m*/
        return projectGoFiles;
    }
}

From source file:cd.go.contrib.elasticagents.docker.DockerContainer.java

private static List<String> environmentFrom(CreateAgentRequest request, PluginSettings settings,
        String containerName) {/*from   w  ww .  ja v  a 2 s.  c  o  m*/
    Set<String> env = new HashSet<>();

    env.addAll(settings.getEnvironmentVariables());
    if (StringUtils.isNotBlank(request.properties().get("Environment"))) {
        env.addAll(splitIntoLinesAndTrimSpaces(request.properties().get("Environment")));
    }

    env.addAll(Arrays.asList("GO_EA_MODE=" + mode(), "GO_EA_SERVER_URL=" + settings.getGoServerUrl()));

    env.addAll(request.autoregisterPropertiesAsEnvironmentVars(containerName));

    return new ArrayList<>(env);
}