Example usage for java.util Collections unmodifiableMap

List of usage examples for java.util Collections unmodifiableMap

Introduction

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

Prototype

public static <K, V> Map<K, V> unmodifiableMap(Map<? extends K, ? extends V> m) 

Source Link

Document

Returns an unmodifiable view of the specified map.

Usage

From source file:edu.umich.flowfence.common.TaintSet.java

private TaintSet(Map<? extends ComponentName, ? extends Float> taintMap) {
    if (taintMap == null || taintMap.isEmpty()) {
        taints = Collections.emptyMap();
    } else {//from  w w w  .j  a v  a 2s . c om
        taints = Collections.unmodifiableMap(taintMap);
    }
}

From source file:com.agileapes.couteau.http.io.impl.ImmutableHttpRequest.java

@Override
public Map<String, String> getParameters() {
    return Collections.unmodifiableMap(parameters);
}

From source file:org.nuxeo.box.api.service.BoxServiceImpl.java

@Override
public BoxCollection searchBox(String term, CoreSession session, String limit, String offset)
        throws ClientException {
    final Map<String, Object> collectionProperties = new HashMap<>();
    StringBuilder query = new StringBuilder();
    query.append("SELECT * FROM " + "Document where ecm:fulltext = '" + term + "'");
    DocumentModelList documentModels = session.query(query.toString(), null, Long.parseLong(limit),
            Long.parseLong(offset), false);
    // Adapt all documents to box document listing to get all properties
    List<BoxTypedObject> boxDocuments = new ArrayList<>();
    for (DocumentModel doc : documentModels) {
        BoxAdapter boxAdapter = doc.getAdapter(BoxAdapter.class);
        boxDocuments.add(boxAdapter.getBoxItem());
    }/*  w ww  .  j  ava  2 s. c  o  m*/
    collectionProperties.put(BoxCollection.FIELD_ENTRIES, boxDocuments);
    collectionProperties.put(BoxCollection.FIELD_TOTAL_COUNT, documentModels.size());
    return new BoxCollection(Collections.unmodifiableMap(collectionProperties));
}

From source file:ca.uhn.fhir.context.RuntimeResourceDefinition.java

@Override
public void sealAndInitialize(
        Map<Class<? extends IElement>, BaseRuntimeElementDefinition<?>> theClassToElementDefinitions) {
    super.sealAndInitialize(theClassToElementDefinitions);

    myNameToSearchParam = Collections.unmodifiableMap(myNameToSearchParam);

    ArrayList<RuntimeSearchParam> searchParams = new ArrayList<RuntimeSearchParam>(
            myNameToSearchParam.values());
    Collections.sort(searchParams, new Comparator<RuntimeSearchParam>() {
        @Override//ww  w.jav a 2  s.  co m
        public int compare(RuntimeSearchParam theArg0, RuntimeSearchParam theArg1) {
            return theArg0.getName().compareTo(theArg1.getName());
        }
    });
    mySearchParams = Collections.unmodifiableList(searchParams);

    Class<?> target = getImplementingClass();
    myBaseDefinition = this;
    do {
        target = target.getSuperclass();
        if (IResource.class.isAssignableFrom(target) && target.getAnnotation(ResourceDef.class) != null) {
            myBaseDefinition = (RuntimeResourceDefinition) theClassToElementDefinitions.get(target);
        }
    } while (target.equals(Object.class) == false);
}

From source file:com.aionemu.commons.services.ScriptService.java

/**
 * Returns unmodifiable map with loaded script managers
 *
 * @return unmodifiable map//from w  w w . j av  a  2  s . c  o  m
 */
public Map<File, ScriptManager> getLoadedScriptManagers() {
    return Collections.unmodifiableMap(map);
}

From source file:bg.fourweb.android.rss.Item.java

/**
 * Construct an item. Each field is checked against null and replaced with a default non-null value if needed.
 * //  ww w  .j  av a 2  s .c  o  m
 * @param title
 * @param link
 * @param description
 * @param author
 * @param categories
 * @param comments
 * @param enclosures
 * @param guid
 * @param pubDate
 * @param source
 */
@SuppressWarnings("unchecked")
public Item(String title, String link, String description, String author, List<Category> categories,
        String comments, List<Enclosure> enclosures, Guid guid, String pubDate, Source source,
        Map<String, String> metaValues) {
    this.title = title != null ? title : "";
    this.link = link != null ? link : "";
    this.description = description != null ? description : "";
    this.author = author != null ? author : "";
    this.categories = (List<Category>) (categories != null ? Collections.unmodifiableList(categories)
            : Collections.emptyList());
    this.comments = comments;
    this.enclosures = (List<Enclosure>) (enclosures != null ? Collections.unmodifiableList(enclosures)
            : Collections.emptyList());
    this.guid = guid != null ? guid : new Guid("", false);
    this.pubDate = pubDate != null ? pubDate : "";
    this.source = source != null ? source : new Source("", "");
    long tmp = 0;
    try {
        tmp = StringUtils.isEmpty(pubDate) == false ? DateUtils.parseRFC822(pubDate).getTime() : tmp;
    } catch (ParseException ignored) {
    }
    this.pubDateMillis = tmp;
    if (metaValues == null) {
        metaValues = new HashMap<String, String>();
    }
    this.metaValues = Collections.unmodifiableMap(metaValues);
}

From source file:com.opengamma.analytics.financial.provider.sensitivity.multicurve.SimpleParameterSensitivity.java

/**
 * Returns the sensitivities wrapped in an unmodifiable map
 * @return The sensitivities/*  ww  w. j  a  v  a 2  s.c o m*/
 */
public Map<String, DoubleMatrix1D> getSensitivities() {
    return Collections.unmodifiableMap(_sensitivity);
}

From source file:org.hawkular.alerts.actions.webhook.WebHooks.java

public static Map<String, List<Map<String, String>>> getAllWebHooks() {
    return Collections.unmodifiableMap(instance.webhooks);
}

From source file:datafu.hourglass.schemas.PartitionCollapsingSchemas.java

public Map<String, Schema> getMapInputSchemas() {
    if (_mapInputSchemas == null) {
        _mapInputSchemas = new HashMap<String, Schema>();

        for (Entry<String, String> schemaPair : _inputSchemas.entrySet()) {
            Schema schema = new Schema.Parser().parse(schemaPair.getValue());

            List<Schema> mapInputSchemas = new ArrayList<Schema>();

            if (schema.getType() == Type.UNION) {
                mapInputSchemas.addAll(schema.getTypes());
            } else {
                mapInputSchemas.add(schema);
            }/*  w w  w.  j av  a  2 s. co  m*/

            // feedback from output (optional)
            mapInputSchemas.add(getReduceOutputSchema());

            _mapInputSchemas.put(schemaPair.getKey(), Schema.createUnion(mapInputSchemas));
        }

    }
    return Collections.unmodifiableMap(_mapInputSchemas);
}

From source file:lshw.types.Configurations.java

/**
 * Returns the configurations as an unmodifiable {@link Map} where the key is the {@link Configuration} id and the value is the
 * {@link Configuration} value.//  w ww  .  j  a  va  2s .  c  o m
 * 
 * @return The configurations as an unmodifiable {@link Map} where the key is the {@link Configuration} id and the value is the
 *         {@link Configuration} value.
 */
public Map<String, String> getConfigurationsMap() {
    Map<String, String> configurations = new HashMap<>();

    for (Configuration configuration : this.getSetting()) {
        configurations.put(configuration.getId(), configuration.getValue());
    }

    return Collections.unmodifiableMap(configurations);
}