Example usage for java.util Collections unmodifiableList

List of usage examples for java.util Collections unmodifiableList

Introduction

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

Prototype

public static <T> List<T> unmodifiableList(List<? extends T> list) 

Source Link

Document

Returns an unmodifiable view of the specified list.

Usage

From source file:ca.travelagency.persistence.query.Criteria.java

public List<OrderBy> getOrderBy() {
    return Collections.unmodifiableList(orderBy);
}

From source file:br.com.thiaguten.persistence.demo.jpa.UserDAOImpl.java

@Override
public List<User> findByName(String name) {
    String jpql = "SELECT u FROM User u WHERE UPPER(u.name) LIKE :name";
    Map<String, String> namedParams = Collections.singletonMap("name", "%" + name.toUpperCase() + "%"); // like IGNORECASE and matchmode ANYWHERE
    List<User> results = persistenceProvider.findByQueryAndNamedParams(getPersistenceClass(), jpql,
            namedParams);/*from   w  ww . j  a  v  a  2s  .c om*/
    if (results.isEmpty()) {
        return Collections.emptyList();
    } else {
        return Collections.unmodifiableList(results);
    }
}

From source file:com.kazuki43zoo.jpetstore.config.ApplicationConfig.java

@Bean
protected List<String> clLanguages() {
    List<String> languageList = new ArrayList<>();
    languageList.add("English");
    languageList.add("Japanese");
    return Collections.unmodifiableList(languageList);
}

From source file:io.kazuki.v0.store.schema.model.Schema.java

@JsonCreator
public Schema(@JsonProperty("attributes") List<Attribute> attributes,
        @JsonProperty("indexes") @Nullable List<IndexDefinition> indexes) {
    Preconditions.checkNotNull(attributes, "attributes");

    this.attributes = Collections.unmodifiableList(attributes);

    Map<String, Attribute> newAttributes = new LinkedHashMap<String, Attribute>();
    for (Attribute attr : attributes) {
        newAttributes.put(attr.getName(), attr);
    }// w w w  .j  a v a 2  s.com

    this.attributeMap = Collections.unmodifiableMap(newAttributes);

    if (indexes == null || indexes.isEmpty()) {
        this.indexes = ImmutableList.of();
        this.indexMap = ImmutableMap.of();
    } else {
        this.indexes = Collections.unmodifiableList(indexes);

        Map<String, IndexDefinition> newIndexes = new LinkedHashMap<String, IndexDefinition>();
        for (IndexDefinition index : indexes) {
            String name = index.getName();

            if (newIndexes.containsKey(name)) {
                throw new IllegalArgumentException("duplicate index entry for '" + name + "'");
            }

            if (newIndexes.size() > 0 && index.isUnique()) {
                throw new IllegalArgumentException(
                        "at most one unique 'index' may be present per schema and must be the first index listed in order");
            }

            for (IndexAttribute attr : index.getIndexAttributes()) {
                String attrName = attr.getName();

                if (!attributeMap.containsKey(attrName)) {
                    throw new IllegalArgumentException(
                            "index '" + name + "' references unknown attribute '" + attrName);
                }
            }

            newIndexes.put(name, index);
        }

        this.indexMap = Collections.unmodifiableMap(newIndexes);
    }
}

From source file:edu.cornell.mannlib.vitro.webapp.controller.admin.SparqlQueryController.java

private static List<Prefix> buildDefaults() {
    Prefix[] array = new Prefix[] { new Prefix("rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"),
            new Prefix("rdfs", "http://www.w3.org/2000/01/rdf-schema#"),
            new Prefix("xsd", "http://www.w3.org/2001/XMLSchema#"),
            new Prefix("owl", "http://www.w3.org/2002/07/owl#"),
            new Prefix("swrl", "http://www.w3.org/2003/11/swrl#"),
            new Prefix("swrlb", "http://www.w3.org/2003/11/swrlb#"),
            new Prefix("vitro", "http://vitro.mannlib.cornell.edu/ns/vitro/0.7#") };
    return Collections.unmodifiableList(Arrays.asList(array));
}

From source file:jodtemplate.pptx.Presentation.java

public List<Relationship> getOtherRelationships() {
    return Collections.unmodifiableList(new ArrayList<>(otherRelationships));
}

From source file:com.link_intersystems.util.UnmodifiableStack.java

private void init(Stack<T> stack) {
    this.stack = stack;
    unmodifiableStackList = Collections.unmodifiableList(stack);
}

From source file:com.branded.holdings.qpc.model.Vet.java

@XmlElement
public List<Specialty> getSpecialties() {
    List<Specialty> sortedSpecs = new ArrayList<Specialty>(getSpecialtiesInternal());
    PropertyComparator.sort(sortedSpecs, new MutableSortDefinition("name", true, true));
    return Collections.unmodifiableList(sortedSpecs);
}

From source file:com.buffalokiwi.aerodrome.jet.JetException.java

public JetException(List<String> messages, Exception previous) {
    super("Jet API Error Response", previous);
    if (messages != null)
        this.messages = Collections.unmodifiableList(messages);
    else//from ww  w .  j  ava 2 s  . c  o m
        this.messages = null;

    response = null;
}

From source file:com.willowtreeapps.androidcontentprovidergenerator.model.Entity.java

public List<Constraint> getConstraints() {
    return Collections.unmodifiableList(mConstraints);
}