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.DirectedSparseGraph.java

public Collection<E> getInEdges(V vertex) {
    if (!containsVertex(vertex))
        return null;
    return Collections.unmodifiableCollection(getIncoming_internal(vertex));
}

From source file:me.st28.flexseries.flexcore.debug.DebugManager.java

public final Collection<DebugTest> getDebugTests(Class<? extends JavaPlugin> pluginClass) {
    Validate.notNull(pluginClass, "Plugin class cannot be null.");
    return !debugTests.containsKey(pluginClass) ? null
            : Collections.unmodifiableCollection(debugTests.get(pluginClass).values());
}

From source file:com.alfaariss.oa.engine.core.idp.IDPStorageManager.java

/**
 * Returns all IDP storage ID's that are available.
 * @return An unmodifiable collection with storage ID's.
 *///from  w  w w  .  j av  a 2  s . c  o  m
public Collection<String> getStorageIDs() {
    return Collections.unmodifiableCollection(_htStorages.keySet());
}

From source file:com.blurengine.blur.framework.ticking.TickMethodsCache.java

/**
 * Loads and caches a {@link Class}//from  w w w .ja  v  a 2  s . c  o m
 *
 * @param clazz class to load and cache for future usage
 *
 * @return list of {@link TickMethod} represented the cached methods
 *
 * @throws IllegalArgumentException thrown if {@code clazz} is {@code Tickable.class}
 */
public static Collection<TickMethod> loadClass(@Nonnull Class<?> clazz) throws IllegalArgumentException {
    Preconditions.checkNotNull(clazz, "clazz cannot be null.");
    if (!LOADED_CLASSES.contains(clazz)) {

        Collection<TickMethod> tickMethods = CLASS_TICK_METHODS.get(clazz); // empty cache list, automatically updates

        { // Load superclasses first
            Class<?> superclass = clazz.getSuperclass();
            // No need for while loop as loadClass will end up reaching here if necessary.
            if (!superclass.equals(Object.class)) {
                tickMethods.addAll(loadClass(superclass));
            }
        }

        for (Method method : clazz.getDeclaredMethods()) {
            TickMethod tickMethod = getTickMethod(clazz, method);
            if (tickMethod != null) {
                tickMethods.add(tickMethod);
            } else {
                Tick tick = method.getDeclaredAnnotation(Tick.class);
                if (tick != null) {
                    try {
                        Preconditions.checkArgument(method.getParameterCount() <= 1,
                                "too many parameters in tick method " + method.getName() + ".");
                        if (method.getParameterCount() > 0) {
                            Preconditions.checkArgument(
                                    method.getParameterTypes()[0].isAssignableFrom(TickerTask.class),
                                    "Invalid parameter in tick method " + method.getName() + ".");
                        }
                        boolean passParams = method.getParameterCount() > 0;
                        // Tickables may be marked private for organisation.
                        method.setAccessible(true);

                        tickMethods.add(new TickMethod(method, passParams, tick));
                    } catch (Exception e) {
                        e.printStackTrace();
                    }
                }
            }
        }
        LOADED_CLASSES.add(clazz);
    }
    return Collections.unmodifiableCollection(CLASS_TICK_METHODS.get(clazz));
}

From source file:de.johni0702.minecraft.gui.container.AbstractGuiContainer.java

@Override
public Collection<GuiElement> getChildren() {
    return Collections.unmodifiableCollection(elements.keySet());
}

From source file:com.haulmont.cuba.gui.presentations.PresentationsImpl.java

@Override
public Collection<Object> getPresentationIds() {
    checkLoad();
    return Collections.unmodifiableCollection(presentations.keySet());
}

From source file:ezbake.data.graph.blueprints.visibility.PropertyValueMap.java

@Override
public Collection<Object> values() {
    Set<Object> values = new HashSet<>(3);
    values.add(value);//w  w  w. jav  a2 s.  c  om
    values.add(visibility);
    if (delete != null) {
        values.add(delete);
    }

    return Collections.unmodifiableCollection(values);
}

From source file:com.vmware.appfactory.datastore.DatastoreClientService.java

@Nonnull
public Collection<DsDatastore> getCachedDatastores() {
    return Collections.unmodifiableCollection(_dsCache.values());
}

From source file:ca.mcgill.cs.creco.data.CRData.java

/**
 * @return An iterator on the product list.
 *///from  ww  w .  j  av  a 2 s  .  com
@Override
public Collection<Product> getProducts() {
    return Collections.unmodifiableCollection(aProducts.values());
}

From source file:com.ponysdk.ui.server.basic.PDateBox.java

@Override
public Collection<PValueChangeHandler<Date>> getValueChangeHandlers() {
    return Collections.unmodifiableCollection(handlers);
}