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.jcup.egradle.codeassist.UserInputProposalFilter.java

/**
 * Filter given proposals//from  w  w  w. ja  v  a2 s . c om
 * 
 * @param proposals
 * @param entered
 *            relevant code, already entered by user
 * @return
 */
Set<Proposal> filterAndSetupProposals(Set<Proposal> proposals, String entered) {
    if (StringUtils.isEmpty(entered)) {
        /* no relavant code entered */
        return new LinkedHashSet<>(proposals);
    }
    String enteredLowerCased = entered.toLowerCase();
    Set<Proposal> filteredResult = new LinkedHashSet<>();
    for (Proposal proposal : proposals) {
        String label = proposal.getLabel();
        String codeLowerCased = label.toLowerCase();
        if (codeLowerCased.indexOf(enteredLowerCased) != -1) {
            filteredResult.add(proposal);
        }
    }
    return filteredResult;

}

From source file:com.icfcc.cache.ehcache.EhCacheCacheManager.java

@Override
protected Collection<Cache> loadCaches() {
    Assert.notNull(this.cacheManager, "A backing EhCache CacheManager is required");
    Status status = this.cacheManager.getStatus();
    Assert.isTrue(Status.STATUS_ALIVE.equals(status),
            "An 'alive' EhCache CacheManager is required - current cache is " + status.toString());

    String[] names = this.cacheManager.getCacheNames();
    Collection<Cache> caches = new LinkedHashSet<Cache>(names.length);
    for (String name : names) {
        caches.add(new EhCacheCache(this.cacheManager.getEhcache(name)));
    }/*from w  w  w.j  a v a  2 s.com*/
    return caches;
}

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

/**
 * Returns a <a href=//from   w  w  w . j a  v a2s. com
 * "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(Number... values) {
    return new ComparatorCondition("=", this,
            new LiteralOperand(new LinkedHashSet<Number>(Arrays.asList(values))));
}

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

/**
 * Returns a <a href=/*  ww w  . jav  a  2  s .  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(String... values) {
    return new ComparatorCondition("=", this,
            new LiteralOperand(new LinkedHashSet<String>(Arrays.asList(values))));
}

From source file:springfox.documentation.schema.Enums.java

private static <E> List<String> transformUnique(E[] values, Function<E, String> mapper) {
    List<String> nonUniqueValues = transform(asList(values), mapper);
    Set<String> uniqueValues = new LinkedHashSet<String>(nonUniqueValues);
    return new ArrayList<String>(uniqueValues);
}

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

/**
 * Returns a <a href=/*  w ww.j  a  va  2  s.c o 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(byte[]... values) {
    return new ComparatorCondition("=", this,
            new LiteralOperand(new LinkedHashSet<byte[]>(Arrays.asList(values))));
}

From source file:com.galeoconsulting.leonardinius.api.impl.ChainingClassLoader.java

public ChainingClassLoader(ClassLoader... classLoaders) {
    Validate.noNullElements(classLoaders, "ClassLoader arguments cannot be null");
    this.classLoaders = ImmutableList
            .of(new LinkedHashSet<ClassLoader>(Arrays.asList(classLoaders)).toArray(new ClassLoader[0]));
}

From source file:org.openmrs.module.emrapi.encounter.EmrOrderServiceImpl_1_10.java

@Override
public void save(List<EncounterTransaction.DrugOrder> drugOrders, Encounter encounter) {
    encounter.setOrders(new LinkedHashSet<org.openmrs.Order>(encounter.getOrders()));
    for (EncounterTransaction.DrugOrder drugOrder : drugOrders) {
        DrugOrder omrsDrugOrder = openMRSDrugOrderMapper.map(drugOrder, encounter);
        encounter.addOrder(omrsDrugOrder);
    }/* ww  w .j  av  a2  s  .c om*/
    encounterService.saveEncounter(encounter);
}

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

@Override
@Transactional(value = "defaultTransactionManager")
public Set<SystemScope> getAll() {
    TypedQuery<SystemScope> query = em.createNamedQuery(SystemScope.QUERY_ALL, SystemScope.class);

    return new LinkedHashSet<>(query.getResultList());
}

From source file:org.jasig.services.persondir.support.xml.XmlPersonAttributeDaoTest.java

public void testAvailableAttributes() {
    final Set<String> expectedAttributes = new LinkedHashSet<String>(
            Arrays.asList("username", "givenName", "familyName", "email", "sisID", "portalId", "emplid"));

    final Set<String> availableQueryAttributes = this.xmlPersonAttributeDao.getAvailableQueryAttributes();
    assertEquals(expectedAttributes, availableQueryAttributes);

    final Set<String> possibleUserAttributeNames = this.xmlPersonAttributeDao.getPossibleUserAttributeNames();
    assertEquals(expectedAttributes, possibleUserAttributeNames);
}