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(Collection<? extends E> c) 

Source Link

Document

Constructs a new linked hash set with the same elements as the specified collection.

Usage

From source file:de.xwic.appkit.core.util.CollectionUtil.java

/**
 * for defensive copying/*from   w ww  . jav  a2s.  c  o m*/
 * @param set
 * @return
 */
public static <E> Set<E> cloneToSet(final Collection<E> set) {
    if (set == null) {
        return null;
    }
    return new LinkedHashSet<E>(set);
}

From source file:com.amazonaws.services.dynamodbv2.xspec.BS.java

/**
 * Returns a <a href=//from  www  .  j av a2s  . co  m
 * "http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/Expressions.SpecifyingConditions.html#ConditionExpressionReference.Comparators"
 * >comparator condition</a> (that evaluates to true if the value of the
 * current attribute is equal to the set of specified values) for building condition
 * expression.
 */
public ComparatorCondition eq(ByteBuffer... values) {
    return new ComparatorCondition("=", this,
            new LiteralOperand(new LinkedHashSet<ByteBuffer>(Arrays.asList(values))));
}

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

/**
 * Constructor with file filters as parameter
 * @param fileFilters filters to set//  www.j av  a 2  s.  c  o  m
 */
public CompositeCascadeFileListFilter(Collection<? extends FileListFilter<F>> fileFilters) {
    this.fileFilters = new LinkedHashSet<FileListFilter<F>>(fileFilters);
}

From source file:com.jd.survey.dao.security.UserDAOImpl.java

@SuppressWarnings("unchecked")
@Transactional//from   w  w  w  .j a va  2  s.  c om
public Set<User> findAll(int startResult, int maxRows) throws DataAccessException {
    Query query = createNamedQuery("User.findAll", startResult, maxRows);
    return new LinkedHashSet<User>(query.getResultList());
}

From source file:com.icfcc.cache.annotation.AnnotationCacheOperationSource.java

/**
 * Create a default {@code AnnotationCacheOperationSource}, supporting public methods
 * that carry the {@code Cacheable} and {@code CacheEvict} annotations.
 * @param publicMethodsOnly whether to support only annotated public methods
 * typically for use with proxy-based AOP), or protected/private methods as well
 * (typically used with AspectJ class weaving)
 *//*  w  ww  .  ja  v a  2  s.  c  om*/
public AnnotationCacheOperationSource(boolean publicMethodsOnly) {
    this.publicMethodsOnly = publicMethodsOnly;
    this.annotationParsers = new LinkedHashSet<CacheAnnotationParser>(1);
    this.annotationParsers.add(new SpringCacheAnnotationParser());
}

From source file:io.gravitee.common.spring.factory.SpringFactoriesLoader.java

private Collection<? extends T> getSpringFactoriesInstances(Class<T> type, Class<?>[] parameterTypes,
        Object... args) {/* w  ww.  j ava  2 s. com*/
    ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
    // Use names and ensure unique to protect against duplicates
    Set<String> names = new LinkedHashSet<>(
            org.springframework.core.io.support.SpringFactoriesLoader.loadFactoryNames(type, classLoader));
    List<T> instances = createSpringFactoriesInstances(type, parameterTypes, classLoader, args, names);
    AnnotationAwareOrderComparator.sort(instances);
    return instances;
}

From source file:org.mitre.oauth2.repository.impl.JpaOAuth2TokenRepository.java

@Override
public Set<OAuth2AccessTokenEntity> getAllAccessTokens() {
    TypedQuery<OAuth2AccessTokenEntity> query = manager.createNamedQuery(OAuth2AccessTokenEntity.QUERY_ALL,
            OAuth2AccessTokenEntity.class);
    return new LinkedHashSet<>(query.getResultList());
}

From source file:iddb.web.security.service.UserServiceFilter.java

@Override
public void init(FilterConfig filterConfig) throws ServletException {
    this.context = filterConfig.getServletContext();
    Map<String, String> local = SecurityConfig.getInstance().getSection("urls");
    if (local == null) {
        urls = Collections.emptyMap();
    } else {/*from   w  w w .j  av a2  s .  c om*/
        urls = new LinkedHashMap<String, Set<String>>();
        for (Entry<String, String> entry : local.entrySet()) {
            Set<String> s = new LinkedHashSet<String>(Arrays.asList(entry.getValue().split(",")));
            urls.put(entry.getKey(), s);
        }
    }
}

From source file:com.boundlessgeo.geoserver.util.RecentObjectCache.java

public <T extends Info> Iterable<Ref> list(Class<T> clazz) {
    List<Ref> list = null;

    EvictingQueue<Ref> q = q(clazz);
    synchronized (q) {
        list = new ArrayList(q);
    }//from  w w  w . j  ava  2s  . co m

    Collections.reverse(list);
    return new LinkedHashSet<>(list);
}

From source file:net.sf.maltcms.chromaui.normalization.spi.charts.PeakGroupRtBoxPlot.java

public List<JFreeChart> createChart() {
    List<JFreeChart> charts = new ArrayList<>();
    LinkedHashSet<ITreatmentGroupDescriptor> treatmentGroups = new LinkedHashSet<>(
            project.getTreatmentGroups());
    List<CategoryPlot> plots = new LinkedList<>();
    for (IPeakGroupDescriptor pgd : pgdl) {
        LinkedHashMap<ITreatmentGroupDescriptor, HashSet<IPeakAnnotationDescriptor>> map = new LinkedHashMap<>();
        for (ITreatmentGroupDescriptor itgd : treatmentGroups) {
            map.put(itgd, new LinkedHashSet<IPeakAnnotationDescriptor>());
        }//w ww.ja v  a  2s . c  o  m
        List<IPeakAnnotationDescriptor> descriptors = pgd.getPeakAnnotationDescriptors();

        DefaultBoxAndWhiskerCategoryDataset baw = new DefaultBoxAndWhiskerCategoryDataset();
        for (IPeakAnnotationDescriptor ipad : descriptors) {
            ITreatmentGroupDescriptor treatmentGroup = ipad.getChromatogramDescriptor().getTreatmentGroup();
            HashSet<IPeakAnnotationDescriptor> descr = map.get(treatmentGroup);
            if (descr == null) {
                descr = new HashSet<>();
                map.put(treatmentGroup, descr);
            }
            descr.add(ipad);
        }
        List<Color> colors = new LinkedList<>();
        for (ITreatmentGroupDescriptor tgd : map.keySet()) {
            String name = getPeakName(pgd);
            baw.add(createBoxAndWhiskerItem(map.get(tgd)), tgd.getName() + " (" + map.get(tgd).size() + ")",
                    name);
            colors.add(tgd.getColor());
        }
        BoxAndWhiskerRenderer renderer = new BoxAndWhiskerRenderer();
        renderer.setFillBox(true);
        renderer.setMeanVisible(false);
        renderer.setMedianVisible(true);
        renderer.setArtifactPaint(new Color(0, 0, 0, 128));
        renderer.setMaximumBarWidth(0.1);

        renderer.setUseOutlinePaintForWhiskers(false);
        //            renderer.setAutoPopulateSeriesFillPaint(true);
        //            renderer.setAutoPopulateSeriesPaint(true);
        //            renderer.setAutoPopulateSeriesOutlinePaint(true);
        NumberAxis yAxis = new NumberAxis("Peak Apex Retention Time");
        yAxis.setAutoRange(true);
        yAxis.setAutoRangeIncludesZero(false);
        CategoryPlot cp = new CategoryPlot(baw, new CategoryAxis("Treatment Groups"), yAxis, renderer);
        Logger.getLogger(getClass().getName()).log(Level.INFO, "Setting {0} colors!", colors.size());
        ChartCustomizer.setSeriesColors(cp, 0.6f, colors);
        //            ChartCustomizer.setSeriesColors(cp, 0.9f,colors);
        plots.add(cp);
        JFreeChart chart = new JFreeChart(cp);
        chart.setTitle(
                "Peak group " + pgd.getDisplayName() + " size: " + pgd.getPeakAnnotationDescriptors().size());
        charts.add(chart);
    }
    //        CategoryAxis ca = new CategoryAxis("Treatment Groups");
    //        NumberAxis va = new NumberAxis("Normalized Peak Area");
    //        CombinedDomainCategoryPlot cdcp = new CombinedDomainCategoryPlot(ca);
    //        for (CategoryPlot cp : plots) {
    //            cp.setRangeAxis(va);
    //            cdcp.add(cp);
    //            break;
    //        }
    //        return new JFreeChart(cdcp);
    return charts;
}