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:com.stratelia.webactiv.util.DBUtil.java

/**
 * Centralization in order to build easily a SQL in clause.
 * @param sqlQuery/*  www  . ja  v  a2 s. c  om*/
 * @param parameters
 * @param allParameters
 * @return
 */
@SuppressWarnings("unchecked")
public static StringBuilder appendListOfParameters(StringBuilder sqlQuery, Collection<?> parameters,
        Collection<?> allParameters) {
    StringBuilder params = new StringBuilder();
    if (parameters != null) {
        for (Object ignored : parameters) {
            if (params.length() > 0) {
                params.append(",");
            }
            params.append("?");
        }
        if (allParameters != null) {
            allParameters.addAll((Collection) parameters);
        }
    }
    return sqlQuery.append("(").append(params.toString()).append(")");
}

From source file:com.datos.vfs.provider.http.HttpFileSystem.java

/**
 * Adds the capabilities of this file system.
 *//* w  ww . j  a va 2 s .  c om*/
@Override
protected void addCapabilities(final Collection<Capability> caps) {
    caps.addAll(HttpFileProvider.capabilities);
}

From source file:com.datos.vfs.provider.webdav.WebdavFileSystem.java

/**
 * Returns the capabilities of this file system.
 * @param caps The Capabilities to add.//w  w w  .  j a  v  a2 s.  com
 */
@Override
protected void addCapabilities(final Collection<Capability> caps) {
    caps.addAll(WebdavFileProvider.capabilities);
}

From source file:cn.edu.zjnu.acm.judge.config.LocaleFactory.java

public LocaleFactory() {
    Collection<String> set = new TreeSet<>(String.CASE_INSENSITIVE_ORDER);
    set.addAll(Arrays.asList("en", "zh"));
    this.allLanguages = set;
}

From source file:net.sourceforge.fenixedu.applicationTier.Servico.gep.ListMasterDegreeStudents.java

@Atomic
public static Collection run(String executionYearName) {
    final ExecutionYear executionYear = ExecutionYear.readExecutionYearByName(executionYearName);

    final Collection<InfoStudentCurricularPlanWithFirstTimeEnrolment> infoStudentCurricularPlans = new ArrayList();
    final Collection<StudentCurricularPlan> studentCurricularPlans = new ArrayList();
    final Collection<DegreeCurricularPlan> masterDegreeCurricularPlans = DegreeCurricularPlan
            .readByDegreeTypeAndState(DegreeType.MASTER_DEGREE, DegreeCurricularPlanState.ACTIVE);
    CollectionUtils.filter(masterDegreeCurricularPlans, new Predicate() {

        @Override/*from   ww  w  .ja v a  2 s . c o m*/
        public boolean evaluate(Object arg0) {
            DegreeCurricularPlan degreeCurricularPlan = (DegreeCurricularPlan) arg0;
            for (ExecutionDegree executionDegree : degreeCurricularPlan.getExecutionDegreesSet()) {
                if (executionDegree.getExecutionYear().equals(executionYear)) {
                    return true;
                }
            }
            return false;
        }

    });

    for (DegreeCurricularPlan degreeCurricularPlan : masterDegreeCurricularPlans) {
        studentCurricularPlans.addAll(degreeCurricularPlan.getStudentCurricularPlansSet());
    }

    for (StudentCurricularPlan studentCurricularPlan : studentCurricularPlans) {

        if (!studentCurricularPlan.isActive()) {
            continue;
        }

        boolean firstTimeEnrolment = true;
        if (studentCurricularPlan.getSpecialization() != null && studentCurricularPlan.getSpecialization()
                .equals(Specialization.STUDENT_CURRICULAR_PLAN_MASTER_DEGREE)) {

            Collection<StudentCurricularPlan> previousStudentCurricularPlans = studentCurricularPlan
                    .getRegistration().getStudentCurricularPlansBySpecialization(
                            Specialization.STUDENT_CURRICULAR_PLAN_MASTER_DEGREE);

            previousStudentCurricularPlans.remove(studentCurricularPlan);
            for (StudentCurricularPlan previousStudentCurricularPlan : previousStudentCurricularPlans) {
                if (previousStudentCurricularPlan.getDegreeCurricularPlan().getDegree()
                        .equals(studentCurricularPlan.getDegreeCurricularPlan().getDegree())) {
                    firstTimeEnrolment = false;
                    break;
                }
            }
        } else if (studentCurricularPlan.getSpecialization() != null && studentCurricularPlan
                .getSpecialization().equals(Specialization.STUDENT_CURRICULAR_PLAN_SPECIALIZATION)) {
            if (!studentCurricularPlan.getDegreeCurricularPlan().getFirstExecutionDegree().getExecutionYear()
                    .equals(executionYear)) {
                continue;
            }
        }

        if (firstTimeEnrolment) {
            if (!studentCurricularPlan.getDegreeCurricularPlan().getFirstExecutionDegree().getExecutionYear()
                    .equals(executionYear)) {
                firstTimeEnrolment = false;
            }
        }

        InfoStudentCurricularPlanWithFirstTimeEnrolment infoStudentCurricularPlan = InfoStudentCurricularPlanWithFirstTimeEnrolment
                .newInfoFromDomain(studentCurricularPlan);
        infoStudentCurricularPlan.setFirstTimeEnrolment(firstTimeEnrolment);
        infoStudentCurricularPlans.add(infoStudentCurricularPlan);
    }

    return infoStudentCurricularPlans;

}

From source file:de.interseroh.report.auth.UserServiceBean.java

@Transactional(readOnly = true)
@Override//from w ww.j a v a  2s.  c  om
public Collection<UserRole> findUserRolesByUserEmail(String email) {
    Collection<UserRoleEntity> userRoles = userRoleRepository.findByUserEmail(email);

    Collection<UserRole> returnUserRoles = new ArrayList<>();
    returnUserRoles.addAll(userRoles);

    return returnUserRoles;
}

From source file:de.visualdependencies.plugin.impl.PluginServiceImpl.java

@Override
public <T extends Plugin> Collection<T> getPlugins(@NonNull final Class<T> pluginType) {

    Assert.notNull(pluginType, "The plugin type must not be null.");

    final Collection<T> plugins = new ArrayList<T>();
    plugins.addAll(getPluginsAsMap(pluginType).values());

    return plugins;
}

From source file:com.screenslicer.core.nlp.NlpUtil.java

public static Collection<String> stems(String src, boolean ignoreCommonWords, boolean oneStemOnly) {
    if (stemsCache.size() > MAX_CACHE) {
        stemsCache.clear();//from  ww w. ja v a 2s .c om
    }
    String cacheKey = src + "<<>>" + Boolean.toString(ignoreCommonWords) + "<<>>"
            + Boolean.toString(oneStemOnly);
    if (stemsCache.containsKey(cacheKey)) {
        return stemsCache.get(cacheKey);
    }
    ignoreCommonWords = false;
    Collection<String> tokens = tokens(src, true);
    Collection<String> stems = new LinkedHashSet<String>();
    for (String word : tokens) {
        List<String> curStems = null;
        try {
            curStems = stemmer.findStems(word, null);
        } catch (Throwable t) {
        }
        if (curStems != null) {
            if (curStems.isEmpty()) {
                String cleanWord = word.toLowerCase().trim();
                if (cleanWord.matches(".*?[^\\p{Punct}].*") && (!ignoreCommonWords
                        || !ignoredTerms.contains(cleanWord) || validTermsByCase.contains(word.trim()))) {
                    stems.add(cleanWord);
                }
            } else {
                if (!ignoreCommonWords) {
                    if (oneStemOnly) {
                        stems.add(curStems.get(0));
                    } else {
                        stems.addAll(curStems);
                    }
                } else {
                    for (String curStem : curStems) {
                        if (!ignoredTerms.contains(curStem) || validTermsByCase.contains(word.trim())) {
                            stems.add(curStem);
                            if (oneStemOnly) {
                                break;
                            }
                        }
                    }
                }
            }
        }
    }
    stemsCache.put(cacheKey, stems);
    return stems;
}

From source file:net.sourceforge.fenixedu.dataTransferObject.InfoSiteEvaluationMarks.java

public Collection<Mark> getSortedMarks() {
    final Collection<Mark> sortedMarks = new TreeSet<Mark>(comparator);
    sortedMarks.addAll(getEvaluation().getMarksSet());
    return sortedMarks;
}

From source file:com.google.code.guice.repository.spi.CustomRepositoryImplementationResolver.java

protected void addExclusions(Collection<Class> exclusions) {
    exclusions.addAll(Arrays.asList(BatchStoreJpaRepository.class, EntityManagerProvider.class));
}