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.offbynull.portmapper.common.UdpCommunicator.java
/** * Constructs a {@link UdpCommunicator} channel. * @param channels channels to use for communication (these will be closed when this class is shutdown) * @throws NullPointerException if any argument is or contains {@code null} *///from www. j a v a 2s . c o m public UdpCommunicator(List<DatagramChannel> channels) { Validate.noNullElements(channels); listeners = new LinkedBlockingQueue<>(); Map<DatagramChannel, LinkedBlockingQueue<ImmutablePair<InetSocketAddress, ByteBuffer>>> intSendQueue = new HashMap<>(); for (DatagramChannel channel : channels) { intSendQueue.put(channel, new LinkedBlockingQueue<ImmutablePair<InetSocketAddress, ByteBuffer>>()); } sendQueue = Collections.unmodifiableMap(intSendQueue); }
From source file:org.dawnsci.commandserver.core.producer.ProcessConsumer.java
/** * Method which configures the submission consumer for the queues and topics required. * //from w w w .ja v a 2s. c om * uri activemq URI, e.g. tcp://sci-serv5.diamond.ac.uk:61616 * submit queue to submit e.g. scisoft.xia2.SUBMISSION_QUEUE * topic topic to notify e.g. scisoft.xia2.STATUS_TOPIC * status queue for status e.g. scisoft.xia2.STATUS_QUEUE * * @param configuration * @throws Exception */ public void init(Map<String, String> configuration) throws Exception { config = Collections.unmodifiableMap(configuration); setUri(new URI(config.get("uri"))); this.submitQName = config.get("submit"); this.statusTName = config.get("topic"); this.statusQName = config.get("status"); }
From source file:com.arpnetworking.clusteraggregator.models.StatusResponse.java
public Map<Period, PeriodMetrics> getLocalMetrics() { return Collections.unmodifiableMap(_localMetrics); }
From source file:dk.clanie.bitcoin.client.response.ListAddressGroupingsResult.java
@SuppressWarnings({ "unchecked", "rawtypes" }) @JsonCreator//w w w . j av a2s. c o m private ListAddressGroupingsResult(Object[] objects) { this.objects = objects; Map<String, BalanceAndAccount> map = newHashMap(); for (Object object : objects) { List oa = (List) object; String address = (String) oa.get(0); BigDecimal amount = BigDecimal.valueOf((Double) oa.get(1)).setScale(BitcoindClient.SCALE); oa.set(1, amount); // Replace the Double with the BigDecimal to make Jackson serialize with right number of decimal places. String account = ((oa.size() > 2) ? (String) oa.get(2) : null); map.put(address, new BalanceAndAccount(amount, account)); } balanceAndAmountPerAddress = Collections.unmodifiableMap(map); }
From source file:com.anrisoftware.sscontrol.scripts.findusedport.FindUsedPort.java
public Map<Integer, String> getServices() { return Collections.unmodifiableMap(services); }
From source file:org.biokoframework.http.exception.impl.ExceptionResponseBuilderImpl.java
@Inject public ExceptionResponseBuilderImpl( @Named("statusCodeMap") Map<Class<? extends BiokoException>, Integer> statusCodesMap) { fStatusCodesMap = Collections.unmodifiableMap(statusCodesMap); }
From source file:cop.raml.utils.javadoc.MethodJavaDoc.java
@NotNull private static Map<String, TagParam> getParams(List<String> doc) { if (CollectionUtils.isEmpty(doc)) return Collections.emptyMap(); Map<String, TagParam> params = new LinkedMap<>(); String paramName = null;// w ww. j ava 2s . c o m StringBuilder buf = null; Matcher matcher; for (String line : doc) { line = line.trim(); if ((matcher = JavaDocTag.PARAM.getPattern().matcher(line)).find()) { if (paramName != null) addParameter(paramName, buf, params); paramName = matcher.group("name"); buf = new StringBuilder(StringUtils.defaultString(matcher.group("text"), "")); } else if (paramName != null) { if (TAG.matcher(line).find()) { addParameter(paramName, buf, params); paramName = null; } else if (buf.length() > 0) buf.append('\n').append(line); else buf.append(line); } } if (paramName != null) addParameter(paramName, buf, params); return params.isEmpty() ? Collections.emptyMap() : Collections.unmodifiableMap(params); }
From source file:org.kmnet.com.fw.common.codelist.EnumCodeList.java
/** * Constructor.//from w w w.ja v a 2s . c om * * @param enumClass Enum class of which this codelist consists. Must implement {@link CodeListItem} * @throws java.lang.IllegalArgumentException if the given class does not implement {@link CodeListItem} */ public EnumCodeList(Class<? extends Enum<?>> enumClass) { Assert.isTrue(CodeListItem.class.isAssignableFrom(enumClass), "the given enumClass must implement " + CodeListItem.class); Map<String, String> codeList = new LinkedHashMap<String, String>(); Method method = ReflectionUtils.findMethod(enumClass, "values"); Enum<?>[] result = (Enum<?>[]) ReflectionUtils.invokeMethod(method, enumClass); for (Enum<?> e : result) { CodeListItem item = (CodeListItem) e; codeList.put(item.getCodeValue(), item.getCodeLabel()); } this.codeListMap = Collections.unmodifiableMap(codeList); }
From source file:com.miko.demo.mongo.model.EntityC.java
public Map<String, String> getAttributes() { return Collections.unmodifiableMap(attributes); }
From source file:com.diffeo.dossier.fc.FeatureCollection.java
/** * Get the dictionary of features.// www . j ava 2 s . c o m * * If the feature collection is read-only, the returned map * is unmodifiable. Otherwise it can be changed freely. * * @return Map from feature name to feature representation */ public Map<String, Feature> getFeatures() { if (readOnly) return Collections.unmodifiableMap(features); else return features; }