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.cornell.mannlib.vitro.webapp.controller.freemarker.ImageUploadHelper.java

/**
 * Internet Explorer can tell us that an image has a funky
 * Microsoft-specific MIME-type, and we can replace it with one that
 * everyone recognizes. This table records those types.
 *//*ww w  .  jav a 2 s .com*/
private static Map<String, String> createNonStandardMimeTypesMap() {
    Map<String, String> map = new HashMap<String, String>();
    map.put("image/x-png", "image/png");
    map.put("image/pjpeg", "image/jpeg");
    return Collections.unmodifiableMap(map);
}

From source file:com.smartitengineering.util.opensearch.impl.QueryImpl.java

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

From source file:ru.jts_dev.gameserver.parser.data.npc.NpcDatasHolder.java

public final Map<Integer, NpcData> getNpcData() {
    return Collections.unmodifiableMap(npcData);
}

From source file:org.crsh.spring.SpringBootstrap.java

public void afterPropertiesSet() throws Exception {

    // Initialise the registerable drivers
    try {/*from   w  ww  .  j  a v a2 s  . c  om*/
        drivers.put("classpath", new ClassPathMountFactory(loader));
        drivers.put("file", new FileMountFactory(Utils.getCurrentDirectory()));
    } catch (Exception e) {
        log.log(Level.SEVERE, "Coult not initialize classpath driver", e);
        return;
    }

    // List beans
    Map<String, Object> attributes = new HashMap<String, Object>();
    attributes.put("factory", factory);
    if (factory instanceof ListableBeanFactory) {
        ListableBeanFactory listable = (ListableBeanFactory) factory;
        attributes.put("beans", new SpringMap(listable));
    }

    //
    PluginDiscovery discovery = new SpringPluginDiscovery(loader, factory);

    //
    start(Collections.unmodifiableMap(attributes), discovery, loader);
}

From source file:edu.wisc.my.stats.dao.support.ConsolidatingQueryInformationDao.java

/**
 * @see edu.wisc.my.stats.dao.QueryInformationDao#getfactByIdMap()
 *//*from w w w .  jav a 2s . co m*/
@SuppressWarnings("unchecked")
public Map<Long, Fact> getfactByIdMap() {
    final Set<Map<Long, Fact>> queryInformationByFactMaps = new HashSet<Map<Long, Fact>>();

    for (final QueryInformationDao queryInformationDao : this.readableQueryInformationDaos) {
        final Map<Long, Fact> queryInformationByFactMap = queryInformationDao.getfactByIdMap();
        queryInformationByFactMaps.add(queryInformationByFactMap);
    }

    final CompositeMap cm = new CompositeMap(
            queryInformationByFactMaps.toArray(new Map[queryInformationByFactMaps.size()]));
    return Collections.unmodifiableMap(cm); //will this work?
}

From source file:net.mymam.upload.UploadMultipartRequestWrapper.java

@Override
public Map getParameterMap() {
    Map<String, String[]> map = new HashMap<>();
    for (String formParam : formParameters.keySet()) {
        map.put(formParam, formParameters.get(formParam).toArray(new String[] {}));
    }// w  w w .  j  a v a2 s. c  o m
    map.putAll(super.getParameterMap());
    return Collections.unmodifiableMap(map);
}

From source file:com.graphhopper.jsprit.core.util.UnassignedJobReasonTracker.java

/**
 * For each job id, it returns frequency distribution of failed constraints (simple name of constraint) in an unmodifiable map.
 *
 * @return//from  w w  w .  ja  v a  2 s.  com
 */
public Map<String, Frequency> getReasons() {
    return Collections.unmodifiableMap(reasons);
}

From source file:epgtools.dumpepgfromts.FileLoader.java

public void load() throws FileNotFoundException {

    //??/*from  w  ww . j av  a  2s .  c  om*/
    if (!tsFile.isFile()) {
        throw new FileNotFoundException(
                "???? = " + tsFile.getAbsolutePath());
    }

    //SDT?EIT?
    final Set<Integer> pids = new HashSet<>();
    pids.addAll(RESERVED_PROGRAM_ID.SDT_OR_BAT.getPids());
    pids.addAll(RESERVED_PROGRAM_ID.EIT_GR_ST.getPids());

    LOG.info("?? = " + tsFile.getAbsolutePath());
    final TsReader reader = new TsReader(tsFile, pids, limit);
    Map<Integer, List<TsPacketParcel>> pid_packets = reader.getPackets();

    Map<Integer, List<Section>> pids_sections_temp = new ConcurrentHashMap<>();
    for (Integer pidKey : pid_packets.keySet()) {
        LOG.info("?pid = " + Integer.toHexString(pidKey) + " pid = "
                + RESERVED_PROGRAM_ID.reverseLookUp(pidKey));
        SectionReconstructor sectionMaker = new SectionReconstructor(pid_packets.get(pidKey), pidKey);
        List<Section> sections = sectionMaker.getSections();
        if (sections != null) {
            LOG.info(" = " + sections.size());
            pids_sections_temp.put(pidKey, sections);
        }
    }
    Map<Integer, List<Section>> pids_sections = Collections.unmodifiableMap(pids_sections_temp);

    pid_packets = null;
    pids_sections_temp = null;

    ChannelDataExtractor chde = new ChannelDataExtractor();
    ProgrammeDataExtractor pgde = new ProgrammeDataExtractor();

    for (Integer pid : pids_sections.keySet()) {
        LOG.info("?pid = " + Integer.toHexString(pid) + " pid = "
                + RESERVED_PROGRAM_ID.reverseLookUp(pid));
        for (Section s : pids_sections.get(pid)) {
            try {
                if (RESERVED_PROGRAM_ID.reverseLookUp(pid) == RESERVED_PROGRAM_ID.SDT_OR_BAT) {
                    chde.makeDataSet(s);
                } else if (RESERVED_PROGRAM_ID.reverseLookUp(pid) == RESERVED_PROGRAM_ID.EIT_GR_ST) {
                    pgde.makeDataSet(s);
                }
            } catch (IllegalArgumentException ex) {
                LOG.warn(ex);
            }
        }
    }
    this.channels = chde.getUnmodifiableDataSet();
    this.programmes = pgde.getUnmodifiableDataSet();
}

From source file:org.craftercms.studio.impl.v1.web.http.MultiReadHttpServletRequestWrapper.java

@Override
public Map<String, String[]> getParameterMap() {
    if (parameterMap == null) {
        Map<String, String[]> result = new LinkedHashMap<String, String[]>();
        decode(getQueryString(), result);
        decode(getPostBodyAsString(), result);
        parameterMap = Collections.unmodifiableMap(result);
    }//from  ww  w . ja v  a 2 s.  c o  m
    return parameterMap;
}

From source file:de.innovationgate.wgpublisher.design.OverlayData.java

public Map<String, ResourceData> getOverlayResources() {
    return Collections.unmodifiableMap(_overlayResources);
}