Example usage for java.util Collections unmodifiableSet

List of usage examples for java.util Collections unmodifiableSet

Introduction

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

Prototype

public static <T> Set<T> unmodifiableSet(Set<? extends T> s) 

Source Link

Document

Returns an unmodifiable view of the specified set.

Usage

From source file:com.vmware.identity.openidconnect.common.ResponseType.java

private ResponseType(Set<ResponseTypeValue> valueSet) {
    this.valueSet = Collections.unmodifiableSet(valueSet);
}

From source file:Main.java

private static <T> Set<T> _asSet(T[] a, boolean makeImmutable) {
    int count = (a != null) ? a.length : 0;

    Set<T> outSet;//from w w  w . j a v  a2s  .com

    if (count == 0) {
        outSet = Collections.emptySet();
    } else {
        if (count == 1) {
            outSet = Collections.singleton(a[0]);
        } else {
            // make the initial size big enough that we don't have to rehash to fit the array, for
            // the .75 load factor we pass in
            int initialSize = (int) Math.ceil(count / .75d);

            outSet = new HashSet<T>(initialSize, .75f);

            for (int i = 0; i < count; i++) {
                outSet.add(a[i]);
            }

            if (makeImmutable) {
                outSet = Collections.unmodifiableSet(outSet);
            }
        }
    }

    return outSet;
}

From source file:com.vmware.identity.openidconnect.common.Scope.java

public Scope(Set<ScopeValue> valueSet) {
    Validate.notEmpty(valueSet, "valueSet");
    this.valueSet = Collections.unmodifiableSet(valueSet);
}

From source file:edu.uci.ics.jung.utils.PredicateUtils.java

/**
 * <p>Returns a <code>Set</code> consisting of all vertices <code>v</code> 
 * in graph <code>g</code> that satisfy predicate <code>p</code>,
 * that is, those for which <code>p.evaluate(v)</code> returns true.</p>
 * //from   w  w w  .j  a va2 s .c o m
 * <p>If <code>g</code> has a <code>SubsetManager</code> that defines
 * a cached subset based on <code>p</code>, that subset is returned.
 */
public static Set getVertices(ArchetypeGraph g, Predicate p) {
    SubsetManager sm = (SubsetManager) g.getUserDatum(ArchetypeGraph.SUBSET_MANAGER);
    if (sm != null) {
        Set s = sm.getVertices(p);
        if (s != null)
            return s;
    }

    Set s = new HashSet();
    Set vertices = g.getVertices();
    for (Iterator v_it = vertices.iterator(); v_it.hasNext();) {
        ArchetypeVertex v = (ArchetypeVertex) v_it.next();
        if (p.evaluate(v))
            s.add(v);
    }
    return Collections.unmodifiableSet(s);
}

From source file:io.syndesis.controllers.integration.NoopHandlerProvider.java

public Set<Integration.Status> getTriggerStatuses() {
    return Collections.unmodifiableSet(new HashSet<>(Arrays.asList(Integration.Status.Activated,
            Integration.Status.Deactivated, Integration.Status.Deleted)));
}

From source file:grails.plugin.cache.GrailsConcurrentLinkedMapCacheManager.java

public Collection<String> getCacheNames() {
    return Collections.unmodifiableSet(cacheMap.keySet());
}

From source file:com.example.auth.ClientEntity.java

public Immutable toImmutable() {
    return new Immutable(clientId, clientSecret, Collections.unmodifiableSet(scopes),
            Collections.unmodifiableSet(authority), redirectUri);
}

From source file:ch.rasc.edsutil.optimizer.graph.Node.java

public Set<Node> getEdges() {
    return Collections.unmodifiableSet(this.edges);
}

From source file:edu.jhu.hlt.parma.inference.transducers.UnigramLM.java

public Set<K> getVocab() {
    return Collections.unmodifiableSet(lm.keySet());
}

From source file:ru.jts_dev.authserver.service.GameServerService.java

public Set<GameServerInfo> getGameServers() {
    return Collections.unmodifiableSet(gameServers);
}