List of usage examples for com.google.common.collect Maps immutableEntry
@GwtCompatible(serializable = true) public static <K, V> Entry<K, V> immutableEntry(@Nullable K key, @Nullable V value)
From source file:ninja.leaping.permissionsex.util.Util.java
public static Map.Entry<String, String> subjectFromString(String input) { String[] entries = input.split(":", 2); if (entries.length == 1) { return Maps.immutableEntry(PermissionsEx.SUBJECTS_GROUP, entries[0]); } else {// w ww . ja v a 2 s .c om return Maps.immutableEntry(entries[0], entries[1]); } }
From source file:cosmos.impl.KeyValueToMultimapQueryResult.java
public static MultimapRecord transform(Value input) { return INSTANCE.apply(Maps.immutableEntry((Key) null, input)); }
From source file:org.trancecode.xml.saxon.SaxonNamespaces.java
public static Iterable<Entry<String, String>> namespaceSequence(final XdmNode node) { final InscopeNamespaceResolver namespaceResolver = new InscopeNamespaceResolver(node.getUnderlyingNode()); return Iterables.transform(prefixes(node), prefix -> Maps.immutableEntry(prefix, namespaceResolver.getURIForPrefix(prefix, true))); }
From source file:org.anarres.simplexml.serializers.dhcp4j.NetworkAddressConverter.java
@Override public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters( Serializer serializer) {/*w ww. j av a 2 s.co m*/ return Collections.singleton(Maps.immutableEntry(NetworkAddress.class, this)); }
From source file:org.anarres.simplexml.serializers.dhcp4j.InterfaceAddressConverter.java
@Override public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters( Serializer serializer) {/*from w w w .jav a2 s . c om*/ return Collections.singleton(Maps.immutableEntry(InterfaceAddress.class, this)); }
From source file:org.anarres.simplexml.serializers.dhcp4j.HardwareAddressConverter.java
@Override public Iterable<? extends Map.Entry<? extends Class<?>, ? extends Converter<?>>> newConverters( Serializer serializer) {// ww w.j a v a 2 s. c om return Collections.singleton(Maps.immutableEntry(HardwareAddress.class, this)); }
From source file:co.cask.cdap.common.collect.AllPairCollector.java
@Override public boolean addElement(Map.Entry<KEY, VALUE> entry) { elements.add(Maps.immutableEntry(entry.getKey(), entry.getValue())); return true; }
From source file:ec.jwsacruncher.ArgsDecoder.java
public static Entry<File, WsaConfig> decodeArgs(String[] args) { WsaConfig config = new WsaConfig(); if (args == null || args.length == 0) { try {/* ww w .ja va 2 s.com*/ loadAll(); // series config.TSMatrix = BasicConfiguration.allSaSeries(true).toArray(config.TSMatrix); config.Matrix = BasicConfiguration.allSaDetails(true).toArray(config.Matrix); writeConfig(new File("wsacruncher.params"), config); } catch (JAXBException e) { System.err.println("Failed to create params file: " + e.getMessage()); } return Maps.immutableEntry(null, config); } File file = null; // int cur = 0; while (cur < args.length) { String cmd = args[cur++]; if (cmd.length() == 0) { return null; } if (cmd.charAt(0) != '-') { file = new File(cmd); } else { switch (cmd) { case "-x": case "-X": { String str = getParamOrNull(args, cur++); if (str == null) { return null; } try { config = readConfig(new File(str)); } catch (JAXBException e) { System.out.print("Invalid configuration file"); return null; } break; } case "-d": { String str = getParamOrNull(args, cur++); if (str == null) { return null; } config.Output = str; break; } case "-m": { String str = getParamOrNull(args, cur++); if (str == null) { return null; } try { config.Matrix = readMatrixConfig(new File(str)); } catch (Exception e) { return null; } break; } case "-p": { String str = getParamOrNull(args, cur++); if (str == null) { return null; } config.policy = str; if (config.getPolicy() == EstimationPolicyType.None) { return null; } break; } case "-f": { String str = getParamOrNull(args, cur++); if (str == null) { return null; } config.layout = str; break; } case "-t": // No longer supported // Config.Diagnostics = true; break; default: return null; } } } return Maps.immutableEntry(file, config); }
From source file:com.google.errorprone.refaster.testdata.template.SamePackageImportsTemplate.java
@BeforeTemplate
Map.Entry<K, V> immutableEntry(K k, V v) {
return Maps.immutableEntry(k, v);
}
From source file:io.atomix.rest.resources.PrimitivesResource.java
@GET @Produces(MediaType.APPLICATION_JSON)/* w w w . j ava 2 s . c o m*/ public Response getPrimitives(@Context PrimitivesService primitives) { Map<String, PrimitiveInfo> primitivesInfo = primitives.getPrimitives().stream() .map(info -> Maps.immutableEntry(info.name(), new PrimitiveInfo(info.name(), info.type().name()))) .collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue())); return Response.ok(primitivesInfo).build(); }