List of usage examples for com.google.common.collect Maps newHashMap
public static <K, V> HashMap<K, V> newHashMap()
From source file:org.eclipse.osee.orcs.core.internal.types.impl.TokenTypeIndex.java
public TokenTypeIndex() { uuidToToken = Maps.newHashMap(); tokenToType = HashBiMap.create(); }
From source file:ai.grakn.graql.internal.gremlin.spanningtree.graph.DenseWeightedGraph.java
public static <V> DenseWeightedGraph<V> from(Iterable<V> nodes, double[][] weights) { final ArrayList<V> nodeList = Lists.newArrayList(nodes); Preconditions.checkArgument(nodeList.size() == weights.length); final Map<V, Integer> indexOf = Maps.newHashMap(); for (int i = 0; i < nodeList.size(); i++) { indexOf.put(nodeList.get(i), i); }/*from w w w . j av a 2 s.com*/ return new DenseWeightedGraph<>(nodeList, indexOf, weights); }
From source file:org.voltcore.agreement.matcher.SiteFailureMatchers.java
static public final Matcher<SiteFailureMessage> siteFailureIs(final Donor<List<Pair<Long, Long>>> safeTxns, final long... survivors) { final Map<Long, Long> safeTxnIds = Maps.newHashMap(); for (Pair<Long, Long> sp : safeTxns.value()) { safeTxnIds.put(sp.getFirst(), sp.getSecond()); }/* w w w .jav a 2 s. c o m*/ final Set<Long> survivorSet = ImmutableSet.copyOf(Longs.asList(survivors)); return new TypeSafeMatcher<SiteFailureMessage>() { @Override public void describeTo(Description d) { d.appendText("SiteFailureMessage [").appendText("survivors: ") .appendValueList("", ", ", "", Longs.asList(survivors)).appendText("safeTxnIds: ") .appendValue(safeTxnIds).appendText("]"); } @Override protected boolean matchesSafely(SiteFailureMessage m) { return equalTo(survivorSet).matches(m.m_survivors) && equalTo(safeTxnIds).matches(m.m_safeTxnIds); } }; }
From source file:nl.knaw.huygens.timbuctoo.graph.Vertex.java
public Vertex(String name) { this.name = name; adjacencies = Maps.newHashMap(); }
From source file:org.kitesdk.apps.spi.PropertyFiles.java
private static Map<String, String> load(InputStream input) { Map<String, String> settings = Maps.newHashMap(); try {/*from w ww. j a va 2 s.com*/ Properties props = new Properties(); props.load(input); for (String propName : props.stringPropertyNames()) { settings.put(propName, props.getProperty(propName)); } } catch (FileNotFoundException e) { throw new AppException(e); } catch (IOException e) { throw new AppException(e); } return settings; }
From source file:com.zaradai.kunzite.trader.services.md.MappingManager.java
public MappingManager(Iterable<MappingConfig> mappings) { mapper = Maps.newHashMap(); idBySid = Maps.newHashMap();// w w w . ja v a 2 s. co m for (MappingConfig mapping : mappings) { Map<String, String> idToSid = Maps.newHashMap(); mapper.put(mapping.getName(), idToSid); // populate the map for (MappingValue mappingValue : mapping.getMappings()) { idToSid.put(mappingValue.getId(), mappingValue.getSid()); } } }
From source file:de.tu_berlin.dima.oligos.type.util.parser.ParserManager.java
public ParserManager() { this.parsers = Maps.newHashMap(); }
From source file:org.apache.jackrabbit.oak.remote.content.ContentRemoteBinaries.java
public ContentRemoteBinaries() { binaries = Maps.newHashMap(); }
From source file:com.griddynamics.jagger.util.AgentUtils.java
public static Map<String, JMXConnector> getJMXConnectors(final String[] jmxServices, final String name) throws IOException { Map<String, JMXConnector> connectors = Maps.newHashMap(); JMXConnector connector;//w ww.j a v a 2 s. c o m for (String service : jmxServices) { int start_prefix = service.lastIndexOf('{'); String prefix = ""; String host = service; if (start_prefix > 0) { int end_prefix = service.lastIndexOf('}'); if (end_prefix > start_prefix) { prefix = service.substring(start_prefix + 1, end_prefix).trim(); if (!prefix.isEmpty()) { prefix += "-"; } host = service.substring(0, start_prefix); } } connector = JMXConnectorFactory.connect(new JMXServiceURL(String.format(JMX_URL_TEMPLATE, host))); connectors.put(prefix + name + host, connector); } return connectors; }
From source file:works.chatterbox.chatterbox.api.impl.rythm.DefaultRythmAPI.java
public DefaultRythmAPI(@NotNull final Chatterbox chatterbox) { Preconditions.checkNotNull(chatterbox, "chatterbox was null"); final Map<String, Object> config = Maps.newHashMap(); config.put("engine.class_loader.parent.impl", new RythmClassLoader(chatterbox.getClass().getClassLoader(), chatterbox)); config.put("feature.type_inference.enabled", true); this.rythm = new RythmEngine(config); }