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:fr.gouv.culture.thesaurus.service.rdf.Concept.java

/**
 * Renvoie l'ensemble des concept schemes auxquels est raccroch le
 * concept./*w w w  . j a v a 2s  .co m*/
 * 
 * @return Ensemble des concept schemes auxquels est raccroch le concept
 *         (ne peut tre <code>null</code> mais peut tre vide)
 */
public Collection<ConceptScheme> getConceptSchemes() {
    return Collections.unmodifiableCollection(schemes);
}

From source file:com.almuramc.bolt.registry.CommonRegistry.java

@Override
public Collection<Lock> getAll() {
    ArrayList<Lock> locks = new ArrayList<Lock>();
    for (TInt21TripleObjectHashMap value : registry.values()) {
        locks.addAll(value.valueCollection());
    }//from  ww w.  ja va2s  .c  om
    return Collections.unmodifiableCollection(locks);
}

From source file:iwein.samples.store.SimpleMessageGroup.java

public Collection<Message<?>> getUnmarked() {
    return Collections.unmodifiableCollection(unmarked);
}

From source file:com.yahoo.bard.webservice.util.Utils.java

/**
 * A recursive call to make a collection and all it's values immutable.
 *
 * @param <T>  The type of the collection
 * @param mutableCollection  The original, potentially mutable, collection
 *
 * @return Am immutable copy whose values are also immutable.
 *//*  w w w  .j a  v  a2  s  . c o m*/
public static <T> Collection<T> makeImmutable(Collection<T> mutableCollection) {
    Collection<T> newCollection;
    try {
        @SuppressWarnings("unchecked")
        Class<Collection<T>> cls = (Class<Collection<T>>) mutableCollection.getClass();
        newCollection = cls.newInstance();
    } catch (InstantiationException | IllegalAccessException e) {
        throw new IllegalStateException(e);
    }
    for (T element : mutableCollection) {
        newCollection.add(Utils.makeImmutable(element));
    }
    return Collections.unmodifiableCollection(newCollection);
}

From source file:hsyndicate.utils.IPUtils.java

public static Collection<String> getIPAddress() {
    if (!cachedIPAddr.isEmpty()) {
        return Collections.unmodifiableCollection(cachedIPAddr);
    } else {//from www.j a v a 2 s .c  om
        try {
            Enumeration e = NetworkInterface.getNetworkInterfaces();
            while (e.hasMoreElements()) {
                NetworkInterface n = (NetworkInterface) e.nextElement();
                Enumeration ee = n.getInetAddresses();
                while (ee.hasMoreElements()) {
                    InetAddress i = (InetAddress) ee.nextElement();
                    if (!i.isLoopbackAddress()) {
                        String hostAddress = i.getHostAddress();
                        cachedIPAddr.add(hostAddress);
                    }
                }
            }
        } catch (SocketException ex) {
            LOG.error("Exception occurred while scanning local interfaces", ex);
        }

        return Collections.unmodifiableCollection(cachedIPAddr);
    }
}

From source file:com.github.ukase.toolkit.fs.FileSource.java

public Collection<String> getFontsUrls() {
    return Collections.unmodifiableCollection(fonts);
}

From source file:org.keycloak.adapters.springsecurity.userdetails.config.AppConfig.java

@Bean
UserDetailsService userDetailsService() {
    Set<UserDetails> users = new HashSet<>();
    User user = new User(KNOWN_EMAIL, "does_not_matter", Arrays.asList(new SimpleGrantedAuthority("user")));
    users.add(user);//from   w  w  w .  ja  va 2  s.  c o m
    return new InMemoryUserDetailsManager(Collections.unmodifiableCollection(users));
}

From source file:com.haulmont.cuba.desktop.gui.components.DesktopFrameActionsHolder.java

public Collection<Action> getActions() {
    return Collections.unmodifiableCollection(actionList);
}

From source file:org.red5.cache.impl.CacheImpl.java

/** {@inheritDoc} */
public Iterator<SoftReference<? extends ICacheable>> getObjects() {
    return Collections.unmodifiableCollection(CACHE.values()).iterator();
}

From source file:iwein.samples.store.SimpleMessageGroup.java

public Collection<Message<?>> getMarked() {
    return Collections.unmodifiableCollection(marked);
}