Example usage for java.util Collections emptySet

List of usage examples for java.util Collections emptySet

Introduction

In this page you can find the example usage for java.util Collections emptySet.

Prototype

@SuppressWarnings("unchecked")
public static final <T> Set<T> emptySet() 

Source Link

Document

Returns an empty set (immutable).

Usage

From source file:com.edmunds.etm.netscaler.NetScalerLoadBalancer.java

@Override
public synchronized Set<VirtualServer> getAllVirtualServers() {
    try {/*from  w w w  . j  a  va 2  s  . co  m*/
        return nitroService.getVirtualServers().list().stream().map(NetScalerLoadBalancer::toVirtualServer)
                .collect(toSet());
    } catch (NitroException e) {
        return Collections.emptySet();
    }
}

From source file:org.keycloak.authz.server.admin.resource.representation.ResourceRepresentation.java

public Set<ScopeRepresentation> getScopes() {
    if (this.scopes == null) {
        return Collections.emptySet();
    }//from   w ww .  j  a  v a2  s .  c o  m

    return Collections.unmodifiableSet(this.scopes);
}

From source file:com.edduarte.argus.stopper.FileStopper.java

private boolean load(String language) {
    File stopwordsFile = new File(Constants.STOPWORDS_DIR, language + ".txt");
    if (stopwordsFile.exists()) {
        try (InputStream is = new FileInputStream(stopwordsFile); Parser parser = new SimpleParser()) {

            Set<MutableString> stopwordsAux = new HashSet<>();
            List<String> lines = IOUtils.readLines(is);
            lines.forEach(line -> {//  w ww.  j a  v  a 2 s . c o  m
                line = line.trim().toLowerCase();
                if (!line.isEmpty()) {
                    int indexOfPipe = line.indexOf('|');

                    MutableString stopwordLine;
                    if (indexOfPipe == -1) {
                        // there are no pipes in this line
                        // -> add the whole line as a stopword
                        stopwordLine = new MutableString(line);

                    } else if (indexOfPipe > 0) {
                        // there is a pipe in this line and it's not the first char
                        // -> add everything from index 0 to the pipe's index
                        String word = line.substring(0, indexOfPipe).trim();
                        stopwordLine = new MutableString(word);
                    } else {
                        return;
                    }

                    Set<MutableString> stopwordsAtLine = parser.parse(stopwordLine).parallelStream()
                            .map(sw -> sw.text).collect(Collectors.toSet());
                    stopwordsAux.addAll(stopwordsAtLine);
                }
            });

            stopwords = ImmutableSet.copyOf(stopwordsAux);
            return true;

        } catch (IOException e) {
            logger.error("There was a problem loading the stopword file.", e);
            stopwords = Collections.emptySet();
        }
    }

    return false;
}

From source file:com.ge.predix.acs.privilege.management.dao.ResourceEntity.java

@Override
public void setAttributes(final Set<Attribute> attributes) {
    if (attributes == null) {
        this.attributes = Collections.emptySet();
    } else {/*from  w w  w  .  jav a2  s.  c  o m*/
        this.attributes = attributes;
    }
}

From source file:edu.internet2.middleware.shibboleth.common.config.security.StaticPKIXSignatureTrustEngineFactoryBean.java

/** {@inheritDoc} */
protected Object createInstance() throws Exception {
    Set<String> names = getTrustedNames();
    if (names == null) {
        names = Collections.emptySet();
    }//from   w ww.j a  v a 2 s  .c  om
    StaticPKIXValidationInformationResolver pkixResolver = new StaticPKIXValidationInformationResolver(
            getPKIXInfo(), names);

    List<KeyInfoProvider> keyInfoProviders = new ArrayList<KeyInfoProvider>();
    keyInfoProviders.add(new DSAKeyValueProvider());
    keyInfoProviders.add(new RSAKeyValueProvider());
    keyInfoProviders.add(new InlineX509DataProvider());
    KeyInfoCredentialResolver keyInfoCredResolver = new BasicProviderKeyInfoCredentialResolver(
            keyInfoProviders);

    PKIXSignatureTrustEngine engine = new PKIXSignatureTrustEngine(pkixResolver, keyInfoCredResolver);

    if (getPKIXValidationOptions() != null) {
        ((CertPathPKIXTrustEvaluator) engine.getPKIXTrustEvaluator())
                .setPKIXValidationOptions(getPKIXValidationOptions());
    }

    return engine;
}

From source file:gov.ca.cwds.cals.service.builder.PlacementHomeEntityAwareDTOBuilder.java

private Set<? extends CWSIdentifier> getHomeLanguages(RFA1aFormDTO form) {
    return Optional.ofNullable(form.getResidence()).map(ResidenceDTO::getHomeLanguages)
            .orElse(Collections.emptySet());
}

From source file:fr.mby.portal.coreimpl.auth.MinimalPortalUserAuthenticationProvider.java

/**
 * @param auth//  w  ww  . java  2  s.c o  m
 * @param user
 */
protected PortalUserAuthentication performAuthentication(final PortalUserAuthentication auth,
        final String password, final Principal user) {
    PortalUserAuthentication resultingAuth = null;

    final String creds = (String) auth.getCredentials();
    if (password.equals(creds)) {
        Set<IRole> roles = null;
        try {
            roles = this.aclManager.retrievePrincipalRoles(user);
        } catch (final PrincipalNotFoundException e) {
            roles = Collections.emptySet();
        }

        final IAuthorization authorizations = new BasicAuthorization(roles);
        resultingAuth = new PortalUserAuthentication(auth, authorizations);
    }

    return resultingAuth;
}

From source file:de.speexx.jira.jan.service.issue.IssueCoreFieldConfigLoader.java

Set<FieldName> fetchAliasses(final CSVRecord record) {
    final String alias = record.get(FIELDNAME_ALIAS_HEADER);
    if (alias == null || alias.length() == 0) {
        return Collections.emptySet();
    }/*  w ww.ja  v a  2 s .  c o m*/
    final String[] aliases = alias.split(KEY_ALIAS_DELIMITER);
    if (aliases.length == 0) {
        return Collections.emptySet();
    }
    final FieldName[] fieldNameAliases = new FieldName[aliases.length];
    for (int i = 0; i < aliases.length; i++) {
        fieldNameAliases[i] = this.fieldNameService.createFieldName(aliases[i].trim());
    }
    return new HashSet<>(Arrays.asList(fieldNameAliases));
}

From source file:com.yahoo.bard.webservice.druid.model.aggregation.Aggregation.java

@Override
@JsonIgnore
public Set<Dimension> getDependentDimensions() {
    return Collections.emptySet();
}

From source file:com.github.rvesse.airline.utils.AirlineUtils.java

public static <T> Set<T> unmodifiableSetCopy(Set<T> set) {
    if (set == null)
        return Collections.emptySet();
    return Collections.unmodifiableSet(new LinkedHashSet<T>(set));
}