Example usage for java.util LinkedHashSet LinkedHashSet

List of usage examples for java.util LinkedHashSet LinkedHashSet

Introduction

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

Prototype

public LinkedHashSet() 

Source Link

Document

Constructs a new, empty linked hash set with the default initial capacity (16) and load factor (0.75).

Usage

From source file:org.cloudfoundry.identity.uaa.error.ExceptionReportHttpMessageConverter.java

@Override
public List<MediaType> getSupportedMediaTypes() {
    Set<MediaType> list = new LinkedHashSet<MediaType>();
    for (HttpMessageConverter<?> converter : messageConverters) {
        list.addAll(converter.getSupportedMediaTypes());
    }//from   w  w w. ja v  a2s. c  o m
    return new ArrayList<MediaType>(list);
}

From source file:hwolf.spring.boot.jsf.JsfConfiguration.java

private Collection<String> getBasePackages() {
    Set<String> basePackages = new LinkedHashSet<>();
    AnnotationAttributes attrs = new AnnotationAttributes(
            metaData.getAnnotationAttributes(EnableJsf.class.getName()));
    String[] basePackagesArray = attrs.getAliasedStringArray("basePackages", EnableJsf.class,
            metaData.getClassName());//w w  w.j a v  a2  s. co  m
    for (String pkg : basePackagesArray) {
        String[] tokenized = StringUtils.tokenizeToStringArray(environment.resolvePlaceholders(pkg),
                ConfigurableApplicationContext.CONFIG_LOCATION_DELIMITERS);
        basePackages.addAll(Arrays.asList(tokenized));
    }
    for (Class<?> clazz : attrs.getClassArray("basePackageClasses")) {
        basePackages.add(ClassUtils.getPackageName(clazz));
    }
    if (basePackages.isEmpty()) {
        basePackages.add(ClassUtils.getPackageName(metaData.getClassName()));
    }
    return basePackages;
}

From source file:edu.uci.ics.jung.graph.DirectedOrderedSparseMultigraph.java

@Override
public Collection<V> getPredecessors(V vertex) {
    if (!containsVertex(vertex))
        return null;
    Set<V> preds = new LinkedHashSet<V>();
    for (E edge : getIncoming_internal(vertex))
        preds.add(this.getSource(edge));

    return Collections.unmodifiableCollection(preds);
}

From source file:cop.maven.plugins.RamlMojoTest.java

@Test(groups = "getSourceDirectories")
public void shouldReturnSourceDirectoryWhenSourceDirectoryNotEmpty() throws Exception {
    setSourceDirectories(mojo, new LinkedHashSet<File>() {
        {/*from  w w  w  .j av  a  2  s  . com*/
            add(FileMock.createDirectory("aaa"));
            add(FileMock.createFile("bbb"));
            add(null);
        }
    });

    Set<File> files = mojo.getSourceDirectories();
    assertThat(files).hasSize(1);
    assertThat(files.iterator().next().getPath()).isEqualTo("aaa");
}

From source file:org.paxml.core.ResourceLocator.java

/**
 * Find all resources with a spring path pattern, from the added resources.
 * /*from   w  ww.  ja v  a2 s.c  o  m*/
 * @param springPattern
 *            the spring path pattern.
 * @param baseFile
 *            the file used to resolve relative path with, can be null if
 *            the pattern is not relative.
 * @return all resource found, never null.
 */
public static Set<PaxmlResource> findResources(String springPattern, Resource baseFile) {

    springPattern = springPattern.trim();

    if (StringUtils.isBlank(springPattern)) {
        throw new PaxmlRuntimeException("Cannot have empty file pattern!");
    }

    Set<PaxmlResource> set = new LinkedHashSet<PaxmlResource>();
    if (!springPattern.startsWith("file:") && !springPattern.startsWith("classpath:")
            && !springPattern.startsWith("classpath*:")) {
        springPattern = getRelativeResource(baseFile, springPattern);
    }
    if (log.isInfoEnabled()) {
        log.info("Searching paxml resource with pattern: " + springPattern);
    }
    try {
        for (Resource res : new PathMatchingResourcePatternResolver().getResources(springPattern)) {

            if (res instanceof ClassPathResource) {
                set.add(new ClasspathResource((ClassPathResource) res));
            } else if (res instanceof UrlResource && res.getURI().toString().startsWith("jar:")) {

                set.add(new ClasspathResource(
                        new ClassPathResource(StringUtils.substringAfterLast(res.getURI().toString(), "!"))));

            } else {
                try {
                    File file = res.getFile();
                    if (file.isFile()) {
                        set.add(new FileSystemResource(file));
                    }
                } catch (IOException e) {
                    throw new PaxmlRuntimeException("Unsupported spring resource: " + res.getURI()
                            + ", of type: " + res.getClass().getName());
                }
            }
        }
    } catch (IOException e) {
        throw new PaxmlRuntimeException("Cannot find resources with spring pattern: " + springPattern, e);
    }
    return set;
}

From source file:com.phoenixnap.oss.ramlapisync.style.checkers.ResponseCodeDefinitionStyleChecker.java

@Override
public Set<StyleIssue> checkActionStyle(RamlActionType key, RamlAction value, IssueLocation location,
        RamlRoot raml) {//from   w  w  w  .  j a  va2s .c  o  m
    logger.debug("Checking Action: " + key);
    Set<StyleIssue> issues = new LinkedHashSet<>();

    //Do we have a check for this verb?
    if (statusChecks.containsKey(key.name())) {
        List<HttpStatus> statuses = statusChecks.get(key.name());
        if (!CollectionUtils.isEmpty(statuses)) {
            for (HttpStatus check : statuses) {
                if (value.getResponses() == null
                        || !value.getResponses().containsKey(String.valueOf(check.value()))) {
                    issues.add(new StyleIssue(location,
                            String.format(DESCRIPTION, key, check.name(), check.value()), value.getResource(),
                            value));
                }
            }

        }
    }

    return issues;
}

From source file:ch.cyberduck.core.openstack.SwiftLocationFeature.java

@Override
public Set<Name> getLocations() {
    final Set<Name> locations = new LinkedHashSet<Name>();
    final List<Region> regions = new ArrayList<Region>(session.getClient().getRegions());
    Collections.sort(regions, new Comparator<Region>() {
        @Override// www  . j av a2s. co  m
        public int compare(final Region r1, final Region r2) {
            if (r1.isDefault()) {
                return -1;
            }
            if (r2.isDefault()) {
                return 1;
            }
            return 0;
        }
    });
    for (Region region : regions) {
        if (StringUtils.isBlank(region.getRegionId())) {
            // v1 authentication contexts do not have region support
            continue;
        }
        locations.add(new SwiftRegion(region.getRegionId()));
    }
    return locations;
}

From source file:com.boundary.sdk.snmp.metric.OidMapList.java

public List<OidMap> getOids(List<Long> ids) {
    Set<OidMap> oids = new LinkedHashSet<OidMap>();

    for (OidMapEntry entry : oidList) {
        if (ids.contains(entry.getId())) {
            for (OidMap oid : entry.getOids()) {
                if (oid.isEnabled()) {
                    oids.add(oid);/* w w w  . ja  va 2 s.com*/
                }
            }
        }
    }

    List<OidMap> list = new ArrayList<OidMap>();
    list.addAll(oids);
    return list;
}

From source file:com.garethahealy.camel.file.loadbalancer.filter.PriorityFileFilter.java

/**
 * Build a list of priorities which this filter will accept
 * i.e.: we have 5 amountOfWatchers with 100 maxMessagesPerPoll and a priority starting at 0.
 * Keep adding 5 until we hit 100, so we end up with: 0, 5, 10, 15 and so on
 *//*from w w w.  ja  v  a2 s.  c  om*/
public void init() {
    possiblePriorities = new LinkedHashSet<Integer>();

    int current = priority;
    while (current < maxMessagesPerPoll) {
        possiblePriorities.add(current);

        current += amountOfWatchers;
        if (current > maxMessagesPerPoll) {
            break;
        }
    }

    //Priority is greater than the maxMessagesPerPoll, so just add that value
    if (possiblePriorities.size() <= 0) {
        possiblePriorities.add(priority);
    }

    cachedPossiblePrioritiesString = Arrays
            .toString(possiblePriorities.toArray(new Integer[possiblePriorities.size()]));

    LOG.debug("Created possible priorities of '{}' for '{}'", cachedPossiblePrioritiesString, priority);
}

From source file:com.googlecode.msidor.springframework.integration.files.CompositeCascadeFileListFilter.java

/**
 * Default constructor
 */
public CompositeCascadeFileListFilter() {
    this.fileFilters = new LinkedHashSet<FileListFilter<F>>();
}