Example usage for java.util Collections unmodifiableCollection

List of usage examples for java.util Collections unmodifiableCollection

Introduction

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

Prototype

public static <T> Collection<T> unmodifiableCollection(Collection<? extends T> c) 

Source Link

Document

Returns an unmodifiable view of the specified collection.

Usage

From source file:edu.uci.ics.jung.graph.UndirectedOrderedSparseMultigraph.java

@Override
public Collection<V> getNeighbors(V vertex) {
    if (!containsVertex(vertex))
        return null;

    Set<V> neighbors = new LinkedHashSet<V>();
    for (E edge : getIncident_internal(vertex)) {
        Pair<V> endpoints = this.getEndpoints(edge);
        V e_a = endpoints.getFirst();/* ww w  .ja va 2  s . co  m*/
        V e_b = endpoints.getSecond();
        if (vertex.equals(e_a))
            neighbors.add(e_b);
        else
            neighbors.add(e_a);
    }

    return Collections.unmodifiableCollection(neighbors);
}

From source file:edu.emory.bmi.aiw.i2b2export.output.PatientDataRowOutputFormatter.java

@Override
protected Collection<Observation> matchingObservations(I2b2ConceptEntity i2b2Concept) throws SQLException {
    switch (StringUtils.upperCase(i2b2Concept.getTableName())) {
    case "CONCEPT_DIMENSION":
        List<Observation> obxs = this.keyToObx.get(i2b2Concept.getI2b2Key());
        if (obxs != null) {
            return Collections.unmodifiableCollection(obxs);
        } else {/*from   www .  j a  va2  s  .  co m*/
            return Collections.emptyList();
        }
    case "PATIENT_DIMENSION":
        if (compareDimensionColumnValue(i2b2Concept, patient)) {
            Observation.Builder b = new Observation.Builder(null).tval(getParam(patient, i2b2Concept));
            Collection<Observation> o = Collections.singleton(b.build());
            return o;
        } else {
            return Collections.emptyList();
        }
    default:
        return Collections.emptyList();
    }
}

From source file:edu.uci.ics.jung.graph.OrderedSparseMultigraph.java

@Override
public Collection<V> getPredecessors(V vertex) {
    if (!containsVertex(vertex))
        return null;

    Set<V> preds = new LinkedHashSet<V>();
    for (E edge : getIncoming_internal(vertex)) {
        if (getEdgeType(edge) == EdgeType.DIRECTED) {
            preds.add(this.getSource(edge));
        } else {//ww  w. java 2 s. co  m
            preds.add(getOpposite(vertex, edge));
        }
    }
    return Collections.unmodifiableCollection(preds);
}

From source file:name.richardson.james.bukkit.utilities.command.argument.AbstractArgument.java

public final Collection<String> getStrings() {
    if (values.contains(null) && values.size() == 1) {
        return Collections.emptyList();
    } else {/*w w  w.  j  av  a2s .  c o m*/
        return Collections.unmodifiableCollection(values);
    }
}

From source file:com.cetsoft.imcache.spring.ImcacheCacheManager.java

public Collection<String> getCacheNames() {
    return Collections.unmodifiableCollection(caches.keySet());
}

From source file:edu.uci.ics.jung.graph.DirectedOrderedSparseMultigraph.java

@Override
public Collection<V> getSuccessors(V vertex) {
    if (!containsVertex(vertex))
        return null;
    Set<V> succs = new LinkedHashSet<V>();
    for (E edge : getOutgoing_internal(vertex))
        succs.add(this.getDest(edge));

    return Collections.unmodifiableCollection(succs);
}

From source file:hudson.plugins.clearcase.ucm.model.ActivitiesDelta.java

/**
 * @return an unmodifiable collection of activities present on left side.
 *//*  ww  w.ja  v  a 2s  .  c o  m*/
public Collection<Activity> getLeft() {
    return Collections.unmodifiableCollection(left);
}

From source file:org.keycloak.adapters.springsecurity.userdetails.authentication.KeycloakUserDetailsAuthenticationProviderTest.java

@Before
public void setUp() throws Exception {
    MockitoAnnotations.initMocks(this);
    Set<UserDetails> users = new HashSet<>();

    user = new User(KNOWN_USERNAME, "password", Arrays.asList(new SimpleGrantedAuthority("user")));
    users.add(user);//  ww  w .  ja v  a  2s.  co  m

    userDetailsService = new InMemoryUserDetailsManager(Collections.unmodifiableCollection(users));

    provider = new KeycloakUserDetailsAuthenticationProvider();
    provider.setUserDetailsService(userDetailsService);

    when(principal.getName()).thenReturn(KNOWN_USERNAME);
    when(account.getPrincipal()).thenReturn(principal);

    token = new KeycloakAuthenticationToken(account);
}

From source file:com.frank.search.solr.core.query.StatsOptions.java

/**
 * @return the fields to facet on.
 */
public Collection<Field> getFacets() {
    return Collections.unmodifiableCollection(state.facets);
}