Example usage for java.util TreeSet addAll

List of usage examples for java.util TreeSet addAll

Introduction

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

Prototype

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

Source Link

Document

Adds all of the elements in the specified collection to this set.

Usage

From source file:com.xpn.xwiki.plugin.chronopolys.UserManager.java

public List getMyLastModifications(XWikiContext context) throws XWikiException {
    TreeSet<Modification> modifications = new TreeSet<Modification>();
    ArrayList<Modification> list = new ArrayList<Modification>();
    List projects = plugin.getProjectManager().getMyProjects(context);

    for (Iterator it = projects.iterator(); it.hasNext();) {
        String name = (String) it.next();
        List mods = plugin.getProjectManager().getProject(name, context).getLastModifications();
        modifications.addAll(mods);
    }/*from   ww w. j a va  2 s . co m*/

    list.addAll(modifications);
    return list;
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.coordinator.thesis.ManageThesisDA.java

private ExecutionYear getExecutionYear(HttpServletRequest request) {
    String id = request.getParameter("executionYearId");
    if (id == null) {
        id = request.getParameter("executionYear");
    }// www .  j  ava  2s . co  m
    if (id == null) {
        TreeSet<ExecutionYear> executionYears = new TreeSet<ExecutionYear>(new ReverseComparator());
        executionYears.addAll(getDegreeCurricularPlan(request).getExecutionYears());

        if (executionYears.isEmpty()) {
            return ExecutionYear.readCurrentExecutionYear();
        } else {
            return executionYears.first();
        }
    } else {
        return FenixFramework.getDomainObject(id);
    }
}

From source file:net.sourceforge.fenixedu.presentationTier.Action.coordinator.thesis.ManageThesisDA.java

private ThesisContextBean getContextBean(HttpServletRequest request) {
    ThesisContextBean bean = getRenderedObject("contextBean");
    RenderUtils.invalidateViewState("contextBean");

    if (bean != null) {
        return bean;
    } else {//from   ww  w  .ja  v a2s  .  c o m
        ExecutionYear executionYear = getExecutionYear(request);

        if (executionYear == null) {
            executionYear = ExecutionYear.readCurrentExecutionYear();
        }

        TreeSet<ExecutionYear> executionYears = new TreeSet<ExecutionYear>(new ReverseComparator());
        executionYears.addAll(getDegreeCurricularPlan(request).getExecutionYears());

        return new ThesisContextBean(executionYears, executionYear);
    }
}

From source file:com.openedit.users.filesystem.FileSystemUserManager.java

public Collection getGroupsSorted() {

    TreeSet treeSet = new java.util.TreeSet(new GroupComparator());

    treeSet.addAll(getGroups());

    return treeSet;
}

From source file:org.fao.fenix.web.modules.olap.server.OlapServiceImpl.java

private static OLAPParameters sortLabels(OLAPParameters p) {

    TreeSet<String> sortedXLabels = new TreeSet<String>(p.getXLabels().values());
    TreeSet<String> sortedZLabels = new TreeSet<String>(p.getZLabels().values());
    TreeSet<String> sortedYLabels = new TreeSet<String>();
    TreeSet<String> sortedWLabels = new TreeSet<String>();

    if (p.getX().contains("date") || p.getX().contains("Date")) {
        sortedXLabels = new TreeSet<String>(new FieldParserComparator());
        sortedXLabels.addAll(p.getXLabels().values());
    }//from   w ww .  ja  v a2  s  .c  o  m
    if (p.getZ().contains("date") || p.getZ().contains("Date")) {
        sortedZLabels = new TreeSet<String>(new FieldParserComparator());
        sortedZLabels.addAll(p.getZLabels().values());
    }

    if (!p.getYLabels().isEmpty()) {
        sortedYLabels = new TreeSet<String>(p.getYLabels().values());
        if (p.getY().contains("date") || p.getY().contains("Date")) {
            sortedYLabels = new TreeSet<String>(new FieldParserComparator());
            sortedYLabels.addAll(p.getYLabels().values());
        }
    }

    if (!p.getWLabels().isEmpty()) {
        sortedWLabels = new TreeSet<String>(p.getWLabels().values());
        if (p.getW().contains("date") || p.getW().contains("Date")) {
            sortedWLabels = new TreeSet<String>(new FieldParserComparator());
            sortedWLabels.addAll(p.getWLabels().values());
        }
    }

    p.setSortedXLabels(sortedXLabels);
    p.setSortedZLabels(sortedZLabels);
    p.setSortedYLabels(sortedYLabels);
    p.setSortedWLabels(sortedWLabels);

    return p;
}

From source file:org.libreplan.web.orders.ManageOrderElementAdvancesModel.java

@Override
public void sortListAdvanceMeasurement() {
    if (advanceAssignment != null) {
        ArrayList<AdvanceMeasurement> advanceMeasurements = new ArrayList<>(
                advanceAssignment.getAdvanceMeasurements());
        Collections.sort(advanceMeasurements, new AdvanceMeasurementComparator());
        TreeSet<AdvanceMeasurement> measurements = new TreeSet<>(new AdvanceMeasurementComparator());
        measurements.addAll(advanceMeasurements);
        this.advanceAssignment.setAdvanceMeasurements(measurements);
    }/*from   w ww. j  a v a  2 s .c o m*/
}

From source file:org.parosproxy.paros.network.HttpMessage.java

public TreeSet<HtmlParameter> getCookieParams() {
    TreeSet<HtmlParameter> set = new TreeSet<>();

    if (!this.getRequestHeader().isEmpty()) {
        set.addAll(this.getRequestHeader().getCookieParams());
    }//from   w  ww  .  j a va 2  s . c o m
    if (!this.getResponseHeader().isEmpty()) {
        set.addAll(this.getResponseHeader().getCookieParams());
    }

    return set;
}

From source file:de.csw.expertfinder.mediawiki.api.MediaWikiAPI.java

/**
 * Gets articles related to the given article.
 * /*from w w w .  j  av a  2  s  . c  o m*/
 * @param articleName
 * @return
 * @throws MediaWikiAPIException
 */
public Set<String> getRelatedArticleNames(String articleName) throws MediaWikiAPIException {
    TreeSet<String> result = new TreeSet<String>();

    result.addAll(getInternalLinks(articleName));

    Set<String> categories = getCategories(articleName);
    for (String category : categories) {
        result.addAll(getArticlesForCategory(category));
    }

    return result;
}

From source file:net.nicholaswilliams.java.teamcity.plugin.buildNumber.PluginConfigurationServiceDefault.java

protected void writeBuildNumbers(List<String> lines) {
    lines.add("\t<build-numbers>");
    int i = 0;//from  w  w  w.  j a v a  2  s .co m

    TreeSet<SharedBuildNumberEntity> set = new TreeSet<SharedBuildNumberEntity>(
            new Comparator<SharedBuildNumberEntity>() {
                @Override
                public int compare(SharedBuildNumberEntity left, SharedBuildNumberEntity right) {
                    int id1 = left.getId();
                    int id2 = right.getId();

                    return id1 < id2 ? -1 : (id2 < id1 ? 1 : 0);
                }
            });
    set.addAll(this.configuration.getBuildNumbers());

    for (SharedBuildNumberEntity number : set) {
        if (i > 0)
            lines.add("");
        i++;

        lines.add("\t\t<build-number id=\"" + number.getId() + "\" incrementOnceForChain=\""
                + number.isIncrementOnceForChain() + "\">");

        lines.add("\t\t\t<name><![CDATA[" + number.getName() + "]]></name>");
        lines.add("\t\t\t<description><![CDATA[" + number.getDescription() + "]]></description>");
        lines.add("\t\t\t<format><![CDATA[" + number.getFormat() + "]]></format>");
        if (number.getDateFormat() != null && number.getDateFormat().trim().length() > 0)
            lines.add("\t\t\t<dateFormat>" + number.getDateFormat() + "</dateFormat>");
        lines.add("\t\t\t<counter>" + number.getCounter() + "</counter>");

        lines.add("\t\t</build-number>");
    }
    if (i == 0)
        lines.add("");
    lines.add("\t</build-numbers>");
    lines.add("");
}