Example usage for java.util TreeSet TreeSet

List of usage examples for java.util TreeSet TreeSet

Introduction

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

Prototype

public TreeSet(SortedSet<E> s) 

Source Link

Document

Constructs a new tree set containing the same elements and using the same ordering as the specified sorted set.

Usage

From source file:com.kelveden.rastajax.representation.flat.FlatRepresentationBuilder.java

@Override
public Set<FlatResource> buildRepresentationFor(final ResourceClass resourceClass) {

    final TreeSet<FlatResource> result = new TreeSet<FlatResource>(RESOURCE_COMPARATOR);

    LOGGER.debug(StringUtils.repeat("-", UNDERLINE_LENGTH));
    LOGGER.debug("Building representation for resource with URI template {}...",
            resourceClass.getUriTemplate());
    LOGGER.debug(StringUtils.repeat("-", UNDERLINE_LENGTH));

    if (resourceClass.isRootResource()) {

        LOGGER.debug("This resource is a root resource.");
        LOGGER.debug("Analyzing methods...");

        final MultiValuedMap<String, ResourceClassMethod> resourceClassMethodsByPath = groupResourceClassMethodsByUriTemplate(
                resourceClass, " |-");

        final List<FlatResource> methodsAsResources = representResourceClassMethods(resourceClass,
                resourceClassMethodsByPath);
        result.addAll(methodsAsResources);

        LOGGER.debug(/*from w  w w  .jav a2 s  .  c o  m*/
                "Finished analyzing methods: flattened methods to {} distinct resource(s) in representation.",
                methodsAsResources.size());

    } else {
        LOGGER.debug("This resource is NOT a root resource - skipping.");
    }

    return result;
}

From source file:io.wcm.handler.mediasource.dam.impl.CropRenditionHandler.java

/**
 * Searches for the biggest web enabled rendition and, if exists, adds a {@link VirtualCropRenditionMetadata} to the
 * list//w ww .j  a  v a2s  .c o  m
 * @param candidates
 * @return {@link Set} of {@link RenditionMetadata}
 */
@Override
protected Set<RenditionMetadata> postProcessCandidates(Set<RenditionMetadata> candidates) {
    TreeSet<RenditionMetadata> processedCandidates = new TreeSet<>(candidates);
    Iterator<RenditionMetadata> descendingIterator = processedCandidates.descendingIterator();
    VirtualCropRenditionMetadata cropRendition = null;
    while (descendingIterator.hasNext()) {
        RenditionMetadata rendition = descendingIterator.next();
        if (DEFAULT_WEB_RENDITION_PATTERN.matcher(rendition.getRendition().getName()).matches()) {
            RenditionMetadata sourceRendition = new RenditionMetadata(rendition.getRendition());
            boolean isImage = FileExtension.isImage(assetFileExtension);
            if (isImage && sourceRendition.getWidth() >= cropDimension.getRight()
                    && sourceRendition.getHeight() >= cropDimension.getBottom()) {
                // found biggest virtual rendition for cropped image
                cropRendition = new VirtualCropRenditionMetadata(sourceRendition.getRendition(),
                        cropDimension.getWidth(), cropDimension.getHeight(), cropDimension);
                break;
            }
        }
    }
    if (cropRendition != null) {
        processedCandidates.add(cropRendition);
    }
    return processedCandidates;
}

From source file:com.couchbase.http.trunk.BasicCookieStore.java

public BasicCookieStore() {
    super();
    this.cookies = new TreeSet<Cookie>(new CookieIdentityComparator());
}

From source file:org.wallride.web.controller.guest.FeedController.java

@RequestMapping("rss.xml")
public String indexRss(BlogLanguage blogLanguage, Model model) {
    ArticleSearchRequest request = new ArticleSearchRequest().withStatus(Post.Status.PUBLISHED)
            .withLanguage(blogLanguage.getLanguage());
    Page<Article> articles = articleService.getArticles(request, DEFAULT_PAGE_REQUEST);
    model.addAttribute("articles", new TreeSet<>(articles.getContent()));
    return "rssFeedView";
}

From source file:games.stendhal.server.entity.npc.condition.KilledCondition.java

/**
 * creates a new KilledCondition./*from   w w  w.j  ava  2 s.  c om*/
 *
 * @param toKill
 *            list of creatures for which the player need to have participated in killing at least one each
 */
@Dev
public KilledCondition(final List<String> toKill) {
    this.toKill = new TreeSet<String>(toKill);
}

From source file:mx.ecosur.multigame.grid.util.BeadString.java

public void add(GridCell cell) {
    if (beads == null)
        beads = new TreeSet<GridCell>(new CellComparator());
    beads.add(cell);// www . j  a v  a  2  s.c  om
}

From source file:com.pc.dailymile.domain.UserStream.java

public Set<Entry> getEntries() {
    if (entries == null) {
        return Collections.emptySet();
    }//from  w  w w .ja va 2s.c o  m
    return new TreeSet<Entry>(entries);
}

From source file:jenkins.security.ClassFilterImplSanityTest.java

@Test
public void whitelistSanity() throws Exception {
    try (InputStream is = ClassFilterImpl.class.getResourceAsStream("whitelisted-classes.txt")) {
        List<String> lines = IOUtils.readLines(is, StandardCharsets.UTF_8).stream()
                .filter(line -> !line.matches("#.*|\\s*")).collect(Collectors.toList());
        assertThat("whitelist is NOT ordered", new TreeSet<>(lines),
                contains(lines.toArray(MemoryReductionUtil.EMPTY_STRING_ARRAY)));
        for (String line : lines) {
            try {
                Class.forName(line);
            } catch (ClassNotFoundException x) {
                System.err.println("skipping checks of unknown class " + line);
            }/*from w w  w.  j a v  a2s  .c o m*/
        }
    }
}

From source file:org.commonjava.cartographer.request.RepositoryContentRequest.java

public void setExcludedSources(final Set<String> excludedSources) {
    if (excludedSources == null) {
        return;/*w w w  . java2s  .  com*/
    }
    this.excludedSources = new TreeSet<String>(excludedSources);
}

From source file:io.promagent.internal.HookMetadataParser.java

public HookMetadataParser(Collection<Path> hookJars) {
    this.hookJars = Collections.unmodifiableSortedSet(new TreeSet<>(hookJars));
}