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:cl.ucn.disc.zoome.zui.layout.OrderedSparseGraph.java

public Collection<E> getEdges() {
    Collection<E> edges = new ArrayList<E>(directed_edges.keySet());
    edges.addAll(undirected_edges.keySet());
    return Collections.unmodifiableCollection(edges);
}

From source file:org.alfresco.repo.policy.PolicyComponentImpl.java

public Collection<PolicyDefinition> getRegisteredPolicies() {
    return Collections.unmodifiableCollection(registeredPolicies.values());
}

From source file:de.iteratec.iteraplan.businesslogic.service.ecore.BuildingBlocksToEcoreServiceImpl.java

public Collection<EObject> convertToEObjects(Collection<BuildingBlock> buildingBlocks) {
    Map<BuildingBlock, EObject> eObjects = Maps.newHashMap();
    if (buildingBlocks == null || buildingBlocks.isEmpty()) {
        return Collections.emptyList();
    }/*from w  ww  . ja  v  a  2s. c  om*/

    MappedEPackage mPackage = createEPackage();
    for (BuildingBlock bb : buildingBlocks) {
        EClass eClass = mPackage.getEClass(bb.getBuildingBlockType());
        EObject instance = EcoreUtil.create(eClass);
        for (EAttribute eAttribute : eClass.getEAllAttributes()) {
            setEAttribute(instance, bb, eAttribute, mPackage);
        }
        eObjects.put(bb, instance);
    }

    for (BuildingBlock bb : buildingBlocks) {
        EClass eClass = mPackage.getEClass(bb.getBuildingBlockType());
        EObject instance = eObjects.get(bb);
        for (EReference eReference : eClass.getEAllReferences()) {
            Object opposite = null;
            try {
                opposite = PropertyUtils.getSimpleProperty(bb, eReference.getName());
            } catch (IllegalAccessException iae) {
                LOGGER.error("Could not access reference value.", iae);
            } catch (InvocationTargetException ite) {
                LOGGER.error("Could not access reference value.", ite);
            } catch (NoSuchMethodException nsme) {
                LOGGER.error("Could not access reference value.", nsme);
            }
            setEStructuralFeature(instance, eReference, opposite, eObjects);
        }
    }

    return Collections.unmodifiableCollection(eObjects.values());
}

From source file:de.uniba.wiai.kinf.pw.projects.lillytab.reasoner.tbox.AssertedRBox.java

@Override
public Collection<R> getRoles(final RoleProperty property) {
    final Collection<R> value = _propertyRoleMap.get(property);
    if (value != null) {
        return Collections.unmodifiableCollection(value);
    } else {/*from  w w w. j av  a2  s. c om*/
        return Collections.emptySet();
    }
}

From source file:com.github.jrh3k5.flume.mojo.plugin.AbstractFlumePluginMojoITest.java

/**
 * Get the dependencies for the given artifact.
 * //from   w w w  .  ja  v  a2s .c o m
 * @param artifactId
 *            The ID of the artifact whose dependencies are to be retrieved.
 * @return A {@link Collection} representing the dependencies for the given artifact.
 * @throws IllegalArgumentException
 *             If no dependencies are found for the given artifact.
 */
protected Collection<String> getDependencies(String artifactId) {
    final Collection<String> dependencies = TRANSITIVE_DEPENDENCIES.get(artifactId);
    if (dependencies == null) {
        throw new IllegalArgumentException("No dependencies found for artifact ID: " + artifactId);
    }
    return Collections.unmodifiableCollection(dependencies);
}

From source file:cl.ucn.disc.zoome.zui.layout.OrderedSparseGraph.java

public Collection<V> getVertices() {
    return Collections.unmodifiableCollection(vertex_maps.keySet());
}

From source file:com.haulmont.cuba.gui.data.impl.CollectionPropertyDatasourceImpl.java

@Override
public Collection<T> getItems() {
    backgroundWorker.checkUIAccess();/*w ww.j a  v  a  2  s  .  com*/

    if (masterDs.getState() == State.NOT_INITIALIZED) {
        return Collections.emptyList();
    } else {
        Collection<T> items = getCollection();
        if (items == null) {
            return Collections.emptyList();
        }
        if (items.isEmpty()) {
            return Collections.emptyList();
        }
        return Collections.unmodifiableCollection(items);
    }
}

From source file:org.web4thejob.orm.MetaReaderServiceImpl.java

@Override
public Collection<EntityMetadata> getEntityMetadatas() {
    List<EntityMetadata> metadatas = new ArrayList<EntityMetadata>(metaCache.values());
    Collections.sort(metadatas, new Comparator<EntityMetadata>() {
        @Override//from   w  w w . j a  v  a2 s.co m
        public int compare(EntityMetadata o1, EntityMetadata o2) {
            return (o1.getSchema() + o1.getFriendlyName()).compareTo(o2.getSchema() + o2.getFriendlyName());
        }
    });
    return Collections.unmodifiableCollection(metadatas);
}

From source file:fr.gouv.culture.thesaurus.service.rdf.Concept.java

public Collection<ConceptCollection> getCollections() {
    return Collections.unmodifiableCollection(this.collections);
}

From source file:com.alfaariss.oa.engine.requestor.configuration.ConfigurationFactory.java

/**
 * {@inheritDoc}//from  w  w  w .  j  a va2 s  .  c o  m
 * @see com.alfaariss.oa.engine.core.requestor.factory.IRequestorPoolFactory#getAllRequestors()
 */
@Override
public Collection<IRequestor> getAllRequestors() throws RequestorException {
    if (_mapRequestors == null)
        return Collections.unmodifiableCollection(new Vector<IRequestor>());

    return Collections.unmodifiableCollection(_mapRequestors.values());
}