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:info.novatec.testit.livingdoc.confluence.demo.bank.Bank.java

public Collection<BankAccount> getAccounts() {
    return Collections.unmodifiableCollection(accounts.values());
}

From source file:org.shredzone.commons.view.manager.ViewManager.java

/**
 * Returns a collection of {@link ViewPattern} that were defined for the given view.
 *
 * @param view//ww w  .j a v a  2  s .c  o  m
 *            View name
 * @param qualifier
 *            Qualifier name, or {@code null}
 * @return Collection of matching {@link ViewPattern}, or {@code null} if there is no
 *         such view
 */
public Collection<ViewPattern> getViewPatternsForView(String view, String qualifier) {
    Map<String, List<ViewPattern>> viewMap = patternMap.get(view);
    if (viewMap != null) {
        List<ViewPattern> result = viewMap.get(qualifier);
        if (result != null) {
            return Collections.unmodifiableCollection(result);
        }
    }
    return null;
}

From source file:edu.emory.bmi.aiw.i2b2export.output.VisitDataRowOutputFormatter.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  w w  w . j av  a  2 s.c om*/
            return Collections.emptyList();
        }
    case "PATIENT_DIMENSION":
        Patient patient = this.visit.getPatient();
        if (compareDimensionColumnValue(i2b2Concept, patient)) {
            Observation.Builder b = new Observation.Builder(this.visit).tval(getParam(patient, i2b2Concept));
            Collection<Observation> o = Collections.singleton(b.build());
            return o;
        } else {
            return Collections.emptyList();
        }
    case "VISIT_DIMENSION":
        return null;
    default:
        return Collections.emptyList();
    }

}

From source file:com.unboundid.scim2.common.types.SchemaResource.java

/**
 * Gets the attributes of the SCIM object from the schema.
 *
 * @return the attributes of the SCIM object.
 *///  ww  w  . j  a v  a 2 s.c o  m
public Collection<AttributeDefinition> getAttributes() {
    return Collections.unmodifiableCollection(attributes);
}

From source file:com.evolveum.midpoint.prism.schema.PrismSchemaImpl.java

@NotNull
@Override
public Collection<Definition> getDefinitions() {
    return Collections.unmodifiableCollection(definitions);
}

From source file:Main.java

/**
 * Functions as per {@link Collections#unmodifiableList(Collection)} with the exception that if the
 * given collection is null, this method will return an unmodifiable empty collection as per
 * {@link Collections#emptyList()}./*from   w w w .  java 2s.c  o m*/
 *
 * @param collection the collection for which an unmodifiable view is to be returned
 * @return an unmodifiable view of the specified collection, or an unmodifiable empty collection if the
 *         given collection is null
 */
public static <T> Collection<T> unmodifiableCollectionNullSafe(Collection<? extends T> collection) {
    if (collection == null) {
        return Collections.emptyList();
    }
    return Collections.unmodifiableCollection(collection);
}

From source file:at.ac.tuwien.big.testsuite.impl.validator.CssValidator.java

@Override
public Collection<String> filesToValidate(String exerciseId) {
    Collection<String> filesToValidate = validationFiles.get(exerciseId);
    if (filesToValidate == null) {
        filesToValidate = new ArrayList<>();
    }//from  w  w w  .j av a  2 s  .c  o m
    return Collections.unmodifiableCollection(filesToValidate);
}

From source file:org.openinfinity.core.security.principal.Identity.java

/**
 * Returns all principals for the user./*from w w w  .ja v a2s.co  m*/
 * 
 * @return
 */
public Collection<Principal> getAllPrincipalsForIdentity() {
    Collection<Principal> principals = new ArrayList<Principal>();
    principals.add(userPrincipal);
    principals.add(tenantPrincipal);
    principals.addAll(rolePrincipals);
    return Collections.unmodifiableCollection(principals);
}

From source file:delfos.dataset.basic.item.ContentDatasetDefault.java

/**
 * Devuelve el conjunto de productos que pueden ser recomendados en el dataset. Los productos que no se encuentran
 * disponibles pueden ser por diversas causas, descatalogados, fuera de stock, entre otras. En cualquier caso son
 * productos que no se recomienda recomendar, valga la redundancia.
 *
 * @return//from   w  ww. ja v  a2  s. c o m
 */
@Override
public Collection<Integer> getAvailableItems() {
    if (availableProducts == null) {
        return allIDs();
    } else {
        return Collections.unmodifiableCollection(availableProducts);
    }
}

From source file:com.hp.autonomy.aci.content.identifier.id.IdsBuilder.java

@Override
public Iterator<Id> iterator() {
    // We may later decide to make IdsBuilder a full Collection but for now we need to avoid allowing removal
    // via Iterator, so wrap our collection
    return Collections.unmodifiableCollection(ids).iterator();
}