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:am.ik.categolj2.api.user.RoleToRoleIdConverterTest.java

@Test
public void testConvertFrom_forUpdate() throws Exception {
    UserResource userResource = new UserResource();
    userResource.setRoles(new ArrayList(Arrays.asList(1, 2)));

    User user = new User();
    Set<Role> roles = new LinkedHashSet<>();
    {/*from w  w  w  .j a  v  a2 s  . c  om*/
        Role role = new Role(1);
        role.setRoleName("ROLE_ADMIN");
        roles.add(role);
    }
    {
        Role role = new Role(2);
        role.setRoleName("ROLE_USER");
        roles.add(role);
    }
    user.setRoles(roles);
    System.out.println(user.getRoles().hashCode());
    mapper.map(userResource, user);
    System.out.println(user.getRoles().hashCode());
    System.out.println(user.getRoles());
}

From source file:com.geewhiz.pacify.managers.FilterManager.java

public LinkedHashSet<Defect> doFilter() {
    LinkedHashSet<Defect> defects = new LinkedHashSet<Defect>();

    for (Object entry : pMarker.getFilesAndArchives()) {
        if (entry instanceof PFile) {
            defects.addAll(filterPFile((PFile) entry));
        } else if (entry instanceof PArchive) {
            defects.addAll(filterPArchive((PArchive) entry));
        } else {/*from ww w  .  j  a  v  a 2 s . c  o  m*/
            throw new NotImplementedException(
                    "Filter implementation for " + entry.getClass().getName() + " not implemented.");
        }
    }

    CheckForNotReplacedTokens checker = new CheckForNotReplacedTokens();
    defects.addAll(checker.checkForErrors(pMarker));

    if (defects.isEmpty()) {
        pMarker.getFile().delete();
    }

    return defects;
}

From source file:com.safetys.framework.jmesa.worksheet.editor.DroplistWorksheetEditor.java

private String getWsColumn(WorksheetColumn worksheetColumn, Object value, Object item) {
    HtmlBuilder html = new HtmlBuilder();
    Limit limit = getCoreContext().getLimit();
    String firstLabel = null;//from  ww  w  .  ja v a  2s .co  m

    Set<String> droplistLabels;

    if (isFirstLabelEmpty) {
        droplistLabels = new LinkedHashSet<String>();
        droplistLabels.add("");
        droplistLabels.addAll(options);
    } else {
        droplistLabels = options;
    }

    StringBuilder array = new StringBuilder();
    array.append("{");

    int i = 0;
    for (String label : droplistLabels) {
        if (label == null)
            label = "";

        array.append("'").append(label).append("':'").append(label).append("'");

        // store first label
        if (i == 0) {
            firstLabel = label;
        }

        if (i < droplistLabels.size() - 1) {
            array.append(", ");
        }

        i++;
    }
    array.append("}");

    // If value is outside of the Set
    if (value == null || !droplistLabels.contains(value.toString())) {
        value = firstLabel;
    }

    html.div();

    html.append(getStyleClass(worksheetColumn));

    html.onmouseover("$.jmesa.setTitle(this, event)");
    html.onclick(getUniquePropertyJavaScript(item) + "$.jmesa.createWsDroplistColumn(this, '" + limit.getId()
            + "'," + UNIQUE_PROPERTY + ",'" + getColumn().getProperty() + "', " + array + ")");
    html.close();
    html.append(escapeHtml(value.toString()));
    html.divEnd();

    return html.toString();
}

From source file:com.panet.imeta.core.config.DigesterConfigManager.java

/**
 * Loads the configuration parameters by delegating to commons digester.
 *//*from w w  w  . j ava2s .co m*/
public Collection<T> load() throws KettleConfigException {
    ClassLoader loader = Thread.currentThread().getContextClassLoader();

    Digester digester = DigesterLoader.createDigester(loader.getResource(rulesURL));

    final Set<T> configObjs = new LinkedHashSet<T>();

    digester.addRule(setNext, new SetNextRule("") {
        @SuppressWarnings("unchecked")
        public void end(String nameSpace, String name) throws Exception {
            configObjs.add((T) digester.peek());
        }
    });

    try {
        digester.parse(loader.getResource(configURL));
    } catch (Exception e) {
        throw new KettleConfigException(e);
    }

    return configObjs;
}

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

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

    //Do we have a check for this verb?
    if (actionsToEnforce.contains(key.name())) {
        boolean schemaFound = false;
        // Now the response
        if (value.getResponses() != null && !value.getResponses().isEmpty()) {
            if (value.getResponses().containsKey("200") && value.getResponses().get("200").getBody() != null) {
                Map<String, RamlMimeType> successResponse = value.getResponses().get("200").getBody();
                if (SchemaHelper.containsBodySchema(successResponse, raml, true)) {
                    schemaFound = true;
                }
            }
            if (value.getResponses().containsKey("201") && value.getResponses().get("201").getBody() != null) {
                Map<String, RamlMimeType> createdResponse = value.getResponses().get("201").getBody();
                if (SchemaHelper.containsBodySchema(createdResponse, raml, true)) {
                    schemaFound = true;
                }
            }
        }

        if (!schemaFound) {
            issues.add(new StyleIssue(location, String.format(DESCRIPTION, key), value.getResource(), value));
        }
    }

    return issues;
}

From source file:com.thoughtworks.go.server.service.WebpackAssetsService.java

public Set<String> getAssetPathsFor(String... assetNames) throws IOException {
    Set<String> result = new LinkedHashSet<>();

    for (String asset : assetNames) {
        result.addAll(getAssetPaths(asset));
    }/* w ww .java 2  s.c o m*/

    return result;
}

From source file:org.cloudfoundry.identity.uaa.authentication.AuthzAuthenticationRequest.java

@Override
public Collection<? extends GrantedAuthority> getAuthorities() {
    if (null != info.get("authorities")) {
        Collection<ExtendedUaaAuthority> returnAuthorities = new LinkedHashSet();

        String[] authorities = StringUtils.commaDelimitedListToStringArray(info.get("authorities"));

        for (String authority : authorities) {
            returnAuthorities.add(new ExtendedUaaAuthority(authority, null));
        }/*from  w w  w.  j  av  a 2s .c  o  m*/

        return returnAuthorities;
    } else {
        return Collections.emptySet();
    }
}

From source file:com.virtusa.isq.vtaf.report.reporter.ReportBuilder.java

/**
 * Instantiates a new report builder./* w ww .ja  va 2 s  . c om*/
 * 
 * @param reportFolderLoc
 *            the report folder loc
 */
public ReportBuilder(final String reportFolderLoc) {

    this.reportFolderLocation = reportFolderLoc;
    rid = 0;
    uniqueTestCaseId = 0;
    reportedTestCases = new LinkedHashSet<Integer>();
}

From source file:edu.northwestern.bioinformatics.studycalendar.web.template.ManagingSitesCommandTest.java

protected void setUp() throws Exception {
    super.setUp();
    study = setId(-22, createNamedInstance("NU123", Study.class));
    site1 = setId(11, createNamedInstance("NU", Site.class));
    site2 = setId(12, createNamedInstance("CMH", Site.class));
    site3 = setId(13, createNamedInstance("RUSH", Site.class));
    site4 = setId(14, createNamedInstance("Managing", Site.class));

    sites = new LinkedHashSet<Object>();
    managingSites = new HashSet<Site>();
    sites.add(site1);//from  w w w . j  a v  a2s . c  o m
    sites.add(site2);
    sites.add(site3);
    sitesList = new ArrayList<Site>();
    sitesList.add(site1);
    sitesList.add(site2);
    sitesList.add(site3);
    allSitesAccess = false;
    studyService = registerMockFor(StudyService.class);
    siteDao = registerDaoMockFor(SiteDao.class);
    user = AuthorizationObjectFactory.createPscUser("jo",
            AuthorizationScopeMappings.createSuiteRoleMembership(PscRole.STUDY_QA_MANAGER).forAllSites(),
            AuthorizationScopeMappings.createSuiteRoleMembership(PscRole.STUDY_CALENDAR_TEMPLATE_BUILDER)
                    .forAllSites());
    listOfRoles = new ArrayList<SuiteRoleMembership>();
    listOfRoles.add(user.getMembership(PscRole.STUDY_CALENDAR_TEMPLATE_BUILDER));
    listOfRoles.add(user.getMembership(PscRole.STUDY_QA_MANAGER));
}

From source file:com.github.rinde.rinsim.examples.demo.swarm.DemoPanel.java

DemoPanel(String s, RoadModel rm, RandomGenerator r) {
    startString = s;
    roadModel = rm;
    rng = r;
    vehicles = new LinkedHashSet<>();
}