Example usage for java.util SortedSet addAll

List of usage examples for java.util SortedSet addAll

Introduction

In this page you can find the example usage for java.util SortedSet 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:net.sourceforge.fenixedu.presentationTier.renderers.providers.ThesisExecutionYearsProvider.java

@Override
public Object provide(Object source, Object currentValue) {
    SortedSet<ExecutionYear> result = new TreeSet<ExecutionYear>(
            new ReverseComparator(ExecutionYear.COMPARATOR_BY_YEAR));
    result.addAll(Bennu.getInstance().getExecutionYearsSet());
    return result;
}

From source file:com.liangc.hq.base.utils.BizappUtils.java

/**
 * This method sorts list of AppdefResourceValue objects 
 * /*from   ww w . j  a  v a 2 s. c  o  m*/
 * @return a list of AppdefResourceValue objects
 */
public static List<AppdefResourceValue> sortAppdefResource(List appdefList, PageControl pc) {
    List sortedList = new ArrayList();
    SortedSet sSet = new TreeSet(new BizappUtils().new AppdefResourceNameComparator(pc));
    sSet.addAll(appdefList);
    CollectionUtils.addAll(sortedList, sSet.iterator());

    // There are duplicated names, figure out where to insert them
    for (Iterator it = appdefList.iterator(); sortedList.size() != appdefList.size() && it.hasNext();) {
        AppdefResourceValue res = (AppdefResourceValue) it.next();

        for (int i = 0; i < sortedList.size(); i++) {
            AppdefResourceValue sorted = (AppdefResourceValue) sortedList.get(i);
            if (sorted.getEntityId().equals(res.getEntityId()))
                break;

            // Either it's meant to go in between or the last
            if (res.getName().toLowerCase().compareTo(sorted.getName().toLowerCase()) < 0
                    || i == sortedList.size() - 1) {
                sortedList.add(i, res);
                break;
            }
        }
    }

    return sortedList;

}

From source file:edu.cornell.mannlib.vitro.webapp.services.shortview.ShortViewServiceImpl.java

/** Get most specific classes from Individual, sorted by alpha. */
private SortedSet<String> figureMostSpecificClassUris(Individual individual) {
    SortedSet<String> classUris = new TreeSet<String>();
    classUris.addAll(individual.getMostSpecificTypeURIs());
    return classUris;
}

From source file:nl.elucidator.maven.analyzer.loader.LoaderTest.java

@Test
public void indexer() throws PlexusContainerException, ComponentLookupException, IOException,
        DependencyCollectionException, InterruptedException {
    IndexSearcher indexSearcher = new IndexSearcher(REPO_URL, WORK_DIRECTORY);
    indexSearcher.update();//from  www . ja  va 2 s.  co  m
    Set<ArtifactInfo> result = indexSearcher.getUniqueGAV();
    SortedSet sortedSet = new TreeSet<ArtifactInfo>(new ArtifactInfoComparator());
    sortedSet.addAll(result);

    LOGGER.debug("Found " + result.size() + " unique artifacts");
    int i = 0;
    for (ArtifactInfo artifactInfo : result) {
        mavenArtifactService.addArtifact(toArtifact(artifactInfo));
    }

    for (ArtifactInfo artifactInfo : result) {
        Artifact artifact = new DefaultArtifact(artifactInfo.groupId, artifactInfo.artifactId,
                artifactInfo.classifier, artifactInfo.fextension, artifactInfo.version);
        try {
            List<DependencyResultRecord> resolved = resolver.resolve(artifact);

            for (DependencyResultRecord dependencyResultRecord : resolved) {
                mavenArtifactService.addRelation(dependencyResultRecord.getFrom(),
                        dependencyResultRecord.getTo(), dependencyResultRecord.getScope());
            }
        } catch (Exception e) {
            LOGGER.error("Error processing: " + artifact, e);
        }
    }

}

From source file:com.github.nethad.clustermeister.provisioning.ec2.CredentialsManager.java

/**
 * Returns a sorted set with all configured, persisted and runtime credentials.
 * /*w  ww .  ja v  a2 s. c o  m*/
 * Note: When calling this method for the first time there may be a slight delay.
 * 
 * @return a newly created sorted set containing all currently known keypairs.
 */
public SortedSet<Credentials> getAllCredentials() {
    SortedSet<Credentials> sortedSet = Sets.newTreeSet();
    sortedSet.addAll(ImmutableSet.copyOf(configuredCredentials));
    sortedSet.addAll(ImmutableSet.copyOf(getNodeKeyPairs()));

    return sortedSet;
}

From source file:org.lightadmin.core.config.domain.unit.DefaultFieldSetConfigurationUnit.java

@Override
public Set<FieldMetadata> getFields() {
    SortedSet<FieldMetadata> orderedFields = newTreeSet(new FieldMetadataUtils.FieldMetadataComparator());
    orderedFields.addAll(this.fields);
    return orderedFields;
}

From source file:org.nuclos.client.ui.model.ChoiceList.java

public void set(Collection<T> available, Comparator<? super T> comp) {
    if (comp == null) {
        throw new NullArgumentException("compAvailable");
    }//ww w. j ava 2  s.  co m
    final SortedSet<T> set = new TreeSet<T>(comp);
    set.addAll(available);
    set(set, new ArrayList<T>(), comp);
}

From source file:org.kalypso.model.wspm.pdb.internal.wspm.DocumentConverter.java

private SortedSet<Document> sortDocuments(final Set<Document> documents) {
    // Sort documents, so pictures come first.
    // Avoids, that the user looks at a warning when looking at a cross section first time
    final Comparator<Document> documentComparator = new DocumentPictureComparator();
    final SortedSet<Document> sortedDocuments = new TreeSet<>(documentComparator);
    sortedDocuments.addAll(documents);

    return sortedDocuments;
}

From source file:org.theospi.portfolio.security.app.AuthorizationFacadeImpl.java

public void addAppAuthorizers(List appAuthorizers) {
    SortedSet sorted = new TreeSet();
    sorted.addAll(getApplicationAuthorizers());
    sorted.addAll(appAuthorizers);/*  www.  j a va 2  s.c  o  m*/
    setApplicationAuthorizers(new ArrayList(sorted));
}

From source file:ru.retbansk.utils.scheduled.impl.ReadEmailAndConvertToXmlSpringImplTest.java

@Test
public void readEmailTest() throws Exception {
    HashSet<DayReport> daySet = reader.readEmail();
    Assert.assertNotNull(daySet);//from  ww w . ja v a 2s  . c om
    Assert.assertEquals(2, daySet.size());
    DayReport fromTester = null;
    DayReport fromAnotherTester = null;
    SortedSet<DayReport> sortedDaySet = new TreeSet<DayReport>();
    sortedDaySet.addAll(daySet);
    Assert.assertEquals(2, sortedDaySet.size());
    Iterator<DayReport> iterator = sortedDaySet.iterator();
    while (iterator.hasNext()) {
        fromAnotherTester = iterator.next();
        fromTester = iterator.next();
    }

    Assert.assertNotNull(fromAnotherTester);
    Assert.assertNotNull(fromTester);
    Assert.assertEquals(USER2, fromTester.getPersonId());
    Assert.assertEquals(USER, fromAnotherTester.getPersonId());
    Assert.assertEquals(3, fromTester.getReportList().size());
    Assert.assertEquals(1, fromAnotherTester.getReportList().size());
    Assert.assertEquals(TEST_STRING, fromTester.getReportList().get(0).getWorkDescription());
    Assert.assertEquals(8, fromAnotherTester.getReportList().get(0).getElapsedTime());
    Assert.assertEquals(TEST_STRING2, fromTester.getReportList().get(2).getWorkDescription());

}