List of usage examples for java.util Collections unmodifiableMap
public static <K, V> Map<K, V> unmodifiableMap(Map<? extends K, ? extends V> m)
From source file:com.joyveb.dbpimpl.cass.prepare.support.exception.CassandraConnectionFailureException.java
public Map<InetAddress, Throwable> getMessagesByHost() { return Collections.unmodifiableMap(messagesByHost); }
From source file:org.terasoluna.tourreservation.app.searchtour.DepYearCodeList.java
@Override public Map<String, String> asMap() { DateTime dateTime = dateFactory.newDateTime(); DateTime nextYearDateTime = dateTime.plusYears(1); Map<String, String> depYearMap = new LinkedHashMap<String, String>(); String thisYear = dateTime.toString("Y"); String nextYear = nextYearDateTime.toString("Y"); depYearMap.put(thisYear, thisYear);// w w w. j ava 2s . co m depYearMap.put(nextYear, nextYear); return Collections.unmodifiableMap(depYearMap); }
From source file:edu.cornell.mannlib.vitro.webapp.application.BuildProperties.java
public BuildProperties(ServletContext ctx) { Map<String, String> map = new HashMap<>(); try (InputStream stream = ctx.getResourceAsStream(WEBAPP_PATH_BUILD_PROPERTIES)) { if (stream == null) { log.debug("Didn't find a resource at '" + WEBAPP_PATH_BUILD_PROPERTIES + "'."); } else {/*w w w .j a v a 2 s . c om*/ Properties props = new Properties(); props.load(stream); for (String key : props.stringPropertyNames()) { map.put(key, props.getProperty(key)); } } } catch (IOException e) { throw new RuntimeException("Failed to load from '" + WEBAPP_PATH_BUILD_PROPERTIES + "'.", e); } propertyMap = Collections.unmodifiableMap(map); }
From source file:com.vmware.identity.idm.IdentityStoreSchemaMapping.java
private IdentityStoreSchemaMapping(Map<String, IdentityStoreObjectMapping> storeObjects) { this._storeObjects = new HashMap<String, IdentityStoreObjectMapping>(); this._storeObjects.putAll(storeObjects); this._storeObjects = Collections.unmodifiableMap(this._storeObjects); }
From source file:de.huberlin.wbi.cfjava.data.Amap.java
private Amap(HashMap<K, V> content) { this.content = Collections.unmodifiableMap(content); }
From source file:Main.java
/** * Copies the given {@link Map} containing another {@link Map} into a new * {@link Map}./*from w w w .j a v a 2 s . c om*/ * * @param <A> * the type of the keys of the outer map * @param <B> * the type of the keys of the map, that is the value of the * outer map * @param <C> * the type of the values of the map, that is the value of the * outer map * @param data * the given map * @return If the given map was empty, a {@link Collections#emptyMap()} is * returned<br> * If the given map contained only one entry, a * {@link Collections#singletonMap(Object, Object)}, containing * said entry, is returned <br> * If the given map contained more than one element, a * {@link Collections#unmodifiableMap(Map)}, containing the entries * of the given map, is returned. */ public static <A, B, C> Map<A, Map<B, C>> copyDeep(Map<A, Map<B, C>> data) { final int size = data.size(); switch (size) { case 0: return Collections.emptyMap(); case 1: final A key = data.keySet().iterator().next(); return Collections.singletonMap(key, copy(data.get(key))); default: final Map<A, Map<B, C>> newData = new HashMap<A, Map<B, C>>(); for (Map.Entry<A, Map<B, C>> entry : data.entrySet()) { newData.put(entry.getKey(), copy(entry.getValue())); } return Collections.unmodifiableMap(newData); } }
From source file:org.springsource.restbucks.support.RepositoryLinkMetadataFactory.java
public RepositoryLinkMetadataFactory(Repositories repositories) { Map<Class<?>, RepositoryInformation> info = new HashMap<Class<?>, RepositoryInformation>(); for (Class<?> domainClass : repositories) { info.put(domainClass, repositories.getRepositoryInformationFor(domainClass)); }//from w w w . j a v a 2 s . co m this.infos = Collections.unmodifiableMap(info); }
From source file:com.kelveden.rastajax.representation.flat.FlatResourceMethod.java
FlatResourceMethod(final String name, final String requestMethodDesignator, final Map<String, List<FlatResourceMethodParameter>> parametersByType, final List<String> consumes, final List<String> produces, final String resourceClass) { this.name = name; this.requestMethodDesignator = requestMethodDesignator; this.parametersByType = Collections.unmodifiableMap(parametersByType); this.produces = Collections.unmodifiableList(produces); this.consumes = Collections.unmodifiableList(consumes); this.resourceClass = resourceClass; }
From source file:io.cloudslang.orchestrator.entities.BranchContexts.java
public Map<String, Serializable> getContexts() { return Collections.unmodifiableMap(contexts); }
From source file:com.siemens.sw360.search.db.SearchDocument.java
/** * Constructor, create empty hashmap if the one provided is null, avoiding null pointer exception *///from www .jav a 2 s .co m SearchDocument(Map<String, Object> document) { if (document != null) { this.document = Collections.unmodifiableMap(document); } else { this.document = new HashMap<>(); } // Set the type of the document type = getProperty("type"); }