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:name.persistent.behaviours.PURLValidationSupport.java

public Set<HttpResponse> purlValidate(Set<RDFObject> targets)
        throws IOException, DatatypeConfigurationException, RepositoryException {
    XMLGregorianCalendar today = today();
    Map<RDFObject, HttpResponse> map = new LinkedHashMap<RDFObject, HttpResponse>();
    for (RDFObject subj : targets) {
        map.put(subj, resolve(subj.getResource().stringValue()));
    }/* w w  w.ja v  a  2 s. com*/
    markResolved(map, today);
    return new LinkedHashSet<HttpResponse>(map.values());
}

From source file:com.developmentsprint.spring.breaker.annotations.AnnotationCircuitBreakerAttributeSource.java

/**
 * Create a custom AnnotationCircuitBreakerAttributeSource, supporting public methods that carry the {@code CircuitBreaker} annotation.
 * /*from  w ww .j  a v a2 s  . com*/
 * @param publicMethodsOnly
 *            whether to support public methods that carry the {@code CircuitBreaker} annotation only (typically for use with proxy-based AOP), or
 *            protected/private methods as well (typically used with AspectJ class weaving)
 */
public AnnotationCircuitBreakerAttributeSource(boolean publicMethodsOnly) {
    this.publicMethodsOnly = publicMethodsOnly;
    this.annotationParsers = new LinkedHashSet<CircuitBreakerAnnotationParser>(2);
    this.annotationParsers.add(new SpringCircuitBreakerAnnotationParser());
}

From source file:com.gs.obevo.db.impl.platforms.db2.Db2SqlExecutorTest.java

@Test
public void testSetPathSqlCreation() {
    // In the test setup, we duplicate sB across the JDBC "set path" return result and the schemas defined in the config to ensure that we drop the dupes in the final output
    JdbcHelper jdbc = mock(JdbcHelper.class);
    Connection conn = mock(Connection.class);
    when(jdbc.query(Matchers.any(Connection.class), Matchers.anyString(),
            Matchers.<ResultSetHandler<Object>>any())).thenReturn("s3,\"s1\",\"sB\",s2");

    // Use LinkedHashSet just to make the test setup easy
    LinkedHashSet<PhysicalSchema> schemas = new LinkedHashSet<PhysicalSchema>(
            Arrays.asList(new PhysicalSchema("sA"), new PhysicalSchema("sB"), new PhysicalSchema("sC")));

    assertEquals("set path s3,s1,sB,s2,sA,sC",
            Db2SqlExecutor.getCurrentPathSql(conn, jdbc, SetAdapter.adapt(schemas).toImmutable()));
}

From source file:org.jct.spellchecker.wordsrepository.cli.commands.SpellCheckerCommandTests.java

@Test
public void testSimpleTreatment() {
    when(spellCheckerCliService.checkWords(Mockito.any(LinkedHashSet.class), Mockito.anyString())).thenReturn(
            new LinkedHashSet<String>(new LinkedHashSet<String>(Arrays.asList("this", "is", "a", "test"))));

    JLineShellComponent shell = bootstrap.getJLineShellComponent();

    CommandResult cr = shell.executeCommand("check --fileName " + TEST_FILE);
    assertThat(cr.isSuccess()).isNotNull();
    assertEquals(true, cr.isSuccess());//from   w  w w.j  a va  2s  . co m
    assertThat(cr.getResult()).isInstanceOf(String.class);
    assertThat(((String) cr.getResult()).contains("There are 4 words to process")).isTrue();

}

From source file:ch.rasc.wampspring.method.DestinationPatternsMessageCondition.java

private DestinationPatternsMessageCondition(Collection<String> patterns, PathMatcher pathMatcher) {
    Assert.notNull(pathMatcher, "pathMatcher is required");

    this.pathMatcher = pathMatcher;
    this.patterns = Collections.unmodifiableSet(new LinkedHashSet<>(patterns));
}

From source file:org.parancoe.web.PopulateInitialDataContextListener.java

@Override
public void contextInitialized(ServletContextEvent evt) {
    ctx = (ApplicationContext) evt.getServletContext()
            .getAttribute(WebApplicationContext.ROOT_WEB_APPLICATION_CONTEXT_ATTRIBUTE);
    Set<Class> fixtureClasses = new LinkedHashSet<Class>(getFixtureClasses());
    if (fixtureClasses.isEmpty()) {
        log.info("Skipping initial data population (no models)");
        return;//  www  .j a v a  2s . c  om
    }

    Map<Class, List> fixtures = YamlFixtureHelper.loadFixturesFromResource("initialData/", fixtureClasses);
    log.info("Populating initial data for models...");

    SessionFactory sessionFactory = (SessionFactory) ctx.getBean("sessionFactory");
    Session session = sessionFactory.openSession();
    session.beginTransaction();
    //Attach transaction to thread
    TransactionSynchronizationManager.bindResource(sessionFactory, new SessionHolder(session));
    TransactionSynchronizationManager.initSynchronization();

    try {
        for (Class clazz : fixtures.keySet()) {
            List modelFixtures = fixtures.get(clazz);
            if (modelFixtures.isEmpty()) {
                log.warn("No data for {}, did you created the fixture file?",
                        YamlFixtureHelper.getModelName(clazz));
                continue;
            }
            populateTableForModel(clazz, modelFixtures);
        }
        fixtures.clear();
        log.info("Populating initial data for models done!");
        session.getTransaction().commit();
        if (session.isOpen()) {
            session.close();
        }
    } catch (Exception e) {
        log.error("Error while populating initial data for models {}", e.getMessage(), e);
        log.debug("Rolling back the populating database transaction");
        session.getTransaction().rollback();
    } finally {
        try {
            if (session.isOpen()) {
                session.close();
            }
        } catch (Exception e) {
            /*do nothing*/
        }
        TransactionSynchronizationManager.unbindResource(sessionFactory);
        TransactionSynchronizationManager.clearSynchronization();
    }
}

From source file:net.solarnetwork.domain.GeneralDatumMetadata.java

/**
 * Copy constructor.//w w  w  . j ava  2  s  . c o  m
 */
public GeneralDatumMetadata(GeneralDatumMetadata other) {
    super();
    if (other.getTags() != null) {
        setTags(new LinkedHashSet<String>(other.getTags()));
    }
    if (other.info != null) {
        info = new LinkedHashMap<String, Object>(other.info);
    }
    if (other.propertyInfo != null) {
        propertyInfo = new LinkedHashMap<String, Map<String, Object>>(other.propertyInfo);
    }
}

From source file:com.mirth.connect.client.ui.ChannelTagDialog.java

@Override
public void setVisible(boolean visible) {
    if (visible) {
        Dimension dlgSize = getPreferredSize();
        Dimension frmSize = parent.getSize();
        Point loc = parent.getLocation();

        if ((frmSize.width == 0 && frmSize.height == 0) || (loc.x == 0 && loc.y == 0)) {
            setLocationRelativeTo(null);
        } else {/*www  .ja v a2s  .c  om*/
            setLocation((frmSize.width - dlgSize.width) / 2 + loc.x,
                    (frmSize.height - dlgSize.height) / 2 + loc.y);
        }

        Set<String> availableTags = new LinkedHashSet<String>(parent.getChannelTagInfo(false).getTags());
        DefaultTableModel model = (DefaultTableModel) tagTable.getModel();
        int rowCount = model.getRowCount();

        for (int i = 0; i < rowCount; i++) {
            availableTags.remove(model.getValueAt(i, 0));
        }

        tagComboBox.setModel(new DefaultComboBoxModel(availableTags.toArray()));

        if (availableTags.size() > 0) {
            tagComboBox.setSelectedIndex(0);
        }

        tagComboBox.requestFocusInWindow();
    }

    super.setVisible(visible);
}

From source file:com.golonzovsky.oauth2.google.security.GoogleAccessTokenConverter.java

public OAuth2Authentication extractAuthentication(Map<String, ?> map) {
    Map<String, String> parameters = new HashMap<>();
    Set<String> scope = parseScopes(map);
    Authentication user = userTokenConverter.extractAuthentication(map);
    String clientId = (String) map.get(CLIENT_ID);
    parameters.put(CLIENT_ID, clientId);
    Set<String> resourceIds = new LinkedHashSet<>(
            map.containsKey(AUD) ? (Collection<String>) map.get(AUD) : Collections.<String>emptySet());
    OAuth2Request request = new OAuth2Request(parameters, clientId, null, true, scope, resourceIds, null, null,
            null);//  w  ww.  j a v  a 2  s  .  com
    return new OAuth2Authentication(request, user);
}

From source file:com.ggk.hrms.authentication.CustomAccessTokenConverter.java

public OAuth2Authentication extractAuthentication(Map<String, ?> map) {
    Map<String, String> parameters = new HashMap<String, String>();
    Set<String> scope = parseScopes(map);
    Authentication user = userTokenConverter.extractAuthentication(map);
    String clientId = (String) map.get(CLIENT_ID);
    parameters.put(CLIENT_ID, clientId);
    Set<String> resourceIds = new LinkedHashSet<String>(
            map.containsKey(AUD) ? (Collection<String>) map.get(AUD) : Collections.<String>emptySet());
    OAuth2Request request = new OAuth2Request(parameters, clientId, null, true, scope, resourceIds, null, null,
            null);/*  w ww.  ja v  a2  s . c o  m*/
    return new OAuth2Authentication(request, user);
}