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:org.openhie.openempi.dao.hibernate.GenericDaoHibernate.java

/**
 * {@inheritDoc}/*from   w  ww .jav  a  2 s  .  com*/
 */
@SuppressWarnings("unchecked")
public List<T> getAllDistinct() {
    Collection result = new LinkedHashSet(getAll());
    return new ArrayList(result);
}

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

/**
 * Returns a <a href=//  w ww  . ja  v  a2 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 not equal to the set of specified values) for
 * building condition expression.
 */
public ComparatorCondition ne(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=/*from   w  ww .j  a v a2  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 not equal to the set of specified values) for
 * building condition expression.
 */
public ComparatorCondition ne(String... values) {
    return new ComparatorCondition("<>", this,
            new LiteralOperand(new LinkedHashSet<String>(Arrays.asList(values))));
}

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

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

From source file:org.jasig.portlet.blackboardvcportlet.dao.impl.MultimediaDaoImpl.java

@Override
public Set<Multimedia> getAllMultimedia() {
    final TypedQuery<MultimediaImpl> query = this.createQuery(this.findAllMultimedia);
    return new LinkedHashSet<Multimedia>(query.getResultList());
}

From source file:com.javaetmoi.core.spring.vfs.Vfs2PathMatchingResourcePatternResolver.java

/**
 * Find all resources that match the given location pattern via the Ant-style PathMatcher.
 * Supports resources in jar files and zip files and in the file system.
 * /*  w w  w .  j  ava 2  s.c  o  m*/
 * @param locationPattern
 *            the location pattern to match
 * @return the result as Resource array
 * @throws IOException
 *             in case of I/O errors
 * @see #doFindPathMatchingJarResources
 * @see #doFindPathMatchingFileResources
 * @see org.springframework.util.PathMatcher
 */
@Override
protected Resource[] findPathMatchingResources(String locationPattern) throws IOException {
    String rootDirPath = determineRootDir(locationPattern);
    String subPattern = locationPattern.substring(rootDirPath.length());
    Resource[] rootDirResources = getResources(rootDirPath);
    Set<Resource> result = new LinkedHashSet<Resource>(16);
    for (Resource rootDirResource : rootDirResources) {
        rootDirResource = resolveRootDirResource(rootDirResource);
        if (isJarResource(rootDirResource)) {
            result.addAll(doFindPathMatchingJarResources(rootDirResource, subPattern));
        } else if (rootDirResource.getURL().getProtocol().startsWith(ResourceUtils.URL_PROTOCOL_VFS)) {
            result.addAll(VfsResourceMatchingDelegate.findMatchingResources(rootDirResource, subPattern,
                    getPathMatcher()));
        } else {
            result.addAll(doFindPathMatchingFileResources(rootDirResource, subPattern));
        }
    }
    if (LOGGER.isDebugEnabled()) {
        LOGGER.debug("Resolved location pattern [" + locationPattern + "] to resources " + result);
    }
    return result.toArray(new Resource[result.size()]);
}

From source file:com.frostwire.platform.FileSystemWalkTest.java

@Test
public void testDir() throws IOException {
    File f1 = File.createTempFile("aaa", null);
    File d1 = f1.getParentFile();
    final File d2 = new File(d1, "d2");
    if (d2.exists()) {
        FileUtils.deleteDirectory(d2);//from  w w w. ja v a2 s.  co  m
    }
    assertTrue(d2.mkdir());
    File f2 = new File(d2, "bbb");
    assertTrue(f2.createNewFile());

    final LinkedList<File> l = new LinkedList<>();

    fs.walk(d1, new FileFilter() {
        @Override
        public boolean accept(File file) {
            return true;
        }

        @Override
        public void file(File file) {
            l.add(file);
        }
    });

    Set<File> set = new LinkedHashSet<>(l);
    assertEquals(set.size(), l.size());

    assertFalse(l.contains(d1));
    assertTrue(l.contains(f1));
    assertTrue(l.contains(d2));
    assertTrue(l.contains(f2));

    l.clear();
    fs.walk(d1, new FileFilter() {
        @Override
        public boolean accept(File file) {
            return !file.equals(d2);
        }

        @Override
        public void file(File file) {
            l.add(file);
        }
    });

    assertFalse(l.contains(d1));
    assertTrue(l.contains(f1));
    assertFalse(l.contains(d2));
    assertFalse(l.contains(f2));

    assertTrue(f2.delete());
    assertTrue(d2.delete());
    assertTrue(f1.delete());
}

From source file:gov.nih.nci.cabig.ctms.web.WebToolsTest.java

public void testRequestPropertiesToMapIsNotMissingAnything() throws Exception {
    Map<String, Object> actual = WebTools.requestPropertiesToMap(request);

    Set<String> missing = new LinkedHashSet<String>(EXPECTED_REQUEST_PROPERTIES);
    for (String property : EXPECTED_REQUEST_PROPERTIES) {
        if (actual.containsKey(property))
            missing.remove(property);/*from  w ww. j a  v  a2  s  .c  o  m*/
    }
    assertEquals("One or more expected properties missing: " + missing, 0, missing.size());
}

From source file:org.openmrs.module.kenyaemr.util.EmrUiUtilsTest.java

@Before
public void setup() throws Exception {
    executeDataSet("dataset/test-concepts.xml");
    executeDataSet("dataset/test-drugs.xml");

    InputStream stream = getClass().getClassLoader().getResourceAsStream("test-regimens.xml");
    regimenManager.loadDefinitionsFromXML(stream);

    this.ui = new FragmentActionUiUtils(null, null, null);

    DrugOrder dapsone = new DrugOrder();
    dapsone.setConcept(Dictionary.getConcept(Dictionary.DAPSONE));
    dapsone.setDose(100.0d);/*w w w. j a  v a 2s . c  om*/
    dapsone.setUnits("mg");
    dapsone.setFrequency("OD");
    DrugOrder stavudine = new DrugOrder();
    stavudine.setConcept(Context.getConceptService().getConcept(84309));
    stavudine.setDose(30.0d);
    stavudine.setUnits("ml");
    stavudine.setFrequency("BD");

    regimen = new RegimenOrder(new LinkedHashSet<DrugOrder>(Arrays.asList(dapsone, stavudine)));
}

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

@SuppressWarnings("unchecked")
@Transactional//from   w  w w .  j  a v  a2 s .co m
public Set<User> findAllInternal(int startResult, int maxRows) throws DataAccessException {
    Query query = createNamedQuery("User.findAllInternal", startResult, maxRows);
    return new LinkedHashSet<User>(query.getResultList());
}