Tabnine Logo
HashMap.get
Code IndexAdd Tabnine to your IDE (free)

How to use
get
method
in
java.util.HashMap

Best Java code snippets using java.util.HashMap.get (Showing top 20 results out of 69,138)

Refine searchRefine arrow

  • HashMap.put
  • HashMap.containsKey
  • HashMap.<init>
  • Iterator.hasNext
  • Iterator.next
  • HashMap.keySet
  • ArrayList.add
  • List.add
  • Set.iterator
origin: libgdx/libgdx

public final int[] getIntArray(int argLength) {
 if (!aints.containsKey(argLength)) {
  aints.put(argLength, new int[argLength]);
 }
 assert (aints.get(argLength).length == argLength) : "Array not built with correct length";
 return aints.get(argLength);
}
origin: FudanNLP/fnlp

private void mapKey(int orikey, int key) throws Exception {
  int orivalue = map.get(orikey);
  int value = map.get(key);
  ArrayList<Integer> oriKeyList = mapList.get(orivalue);
  ArrayList<Integer> keyList = mapList.get(value);
  for (Integer temp : oriKeyList) {
    map.put(temp, value);
    keyList.add(temp);
  }
  mapList.remove(orivalue);
}

origin: alibaba/jstorm

public static <V> HashMap<V, Integer> multi_set(List<V> list) {
  HashMap<V, Integer> rtn = new HashMap<>();
  for (V v : list) {
    int cnt = 1;
    if (rtn.containsKey(v)) {
      cnt += rtn.get(v);
    }
    rtn.put(v, cnt);
  }
  return rtn;
}
origin: apache/hive

/**
 * This method is used only for the analyze command to get the partition specs
 */
public TableSpec getTableSpec() {
 Iterator<String> tName = tableSpecs.keySet().iterator();
 return tableSpecs.get(tName.next());
}
origin: gocd/gocd

public void add(Node node) {
  int level = node.getLevel();
  if (map.get(level) == null) {
    map.put(level, new ArrayList<>());
  }
  map.get(level).add(node);
}
origin: apache/rocketmq

private HashMap<String/* brokerName */, Set<MessageQueue>> buildProcessQueueTableByBrokerName() {
  HashMap<String, Set<MessageQueue>> result = new HashMap<String, Set<MessageQueue>>();
  for (MessageQueue mq : this.processQueueTable.keySet()) {
    Set<MessageQueue> mqs = result.get(mq.getBrokerName());
    if (null == mqs) {
      mqs = new HashSet<MessageQueue>();
      result.put(mq.getBrokerName(), mqs);
    }
    mqs.add(mq);
  }
  return result;
}
origin: spring-projects/spring-framework

@Test
public void testGenericMapWithKeyType() {
  GenericBean<?> gb = new GenericBean<>();
  BeanWrapper bw = new BeanWrapperImpl(gb);
  Map<String, String> input = new HashMap<>();
  input.put("4", "5");
  input.put("6", "7");
  bw.setPropertyValue("longMap", input);
  assertEquals("5", gb.getLongMap().get(new Long("4")));
  assertEquals("7", gb.getLongMap().get(new Long("6")));
}
origin: kaushikgopal/RxJava-Android-Samples

private List<String> getListStringFromMap() {
 List<String> list = new ArrayList<>();
 for (String username : _contributionMap.keySet()) {
  String rowLog = String.format("%s [%d]", username, _contributionMap.get(username));
  list.add(rowLog);
 }
 return list;
}
origin: apache/rocketmq

public FindBrokerResult findBrokerAddressInSubscribe(
  final String brokerName,
  final long brokerId,
  final boolean onlyThisBroker
) {
  String brokerAddr = null;
  boolean slave = false;
  boolean found = false;
  HashMap<Long/* brokerId */, String/* address */> map = this.brokerAddrTable.get(brokerName);
  if (map != null && !map.isEmpty()) {
    brokerAddr = map.get(brokerId);
    slave = brokerId != MixAll.MASTER_ID;
    found = brokerAddr != null;
    if (!found && !onlyThisBroker) {
      Entry<Long, String> entry = map.entrySet().iterator().next();
      brokerAddr = entry.getValue();
      slave = entry.getKey() != MixAll.MASTER_ID;
      found = true;
    }
  }
  if (found) {
    return new FindBrokerResult(brokerAddr, slave, findBrokerVersion(brokerName, brokerAddr));
  }
  return null;
}
origin: alibaba/jstorm

public void add(HashMap<String, ArrayList<TaskMessage>> workerTupleSetMap) {
  for (String key : workerTupleSetMap.keySet()) {
    ArrayList<ArrayList<TaskMessage>> bundle = bundles.get(key);
    if (null == bundle) {
      bundle = new ArrayList<>();
      bundles.put(key, bundle);
    }
    ArrayList tupleSet = workerTupleSetMap.get(key);
    if (null != tupleSet && tupleSet.size() > 0) {
      bundle.add(tupleSet);
    }
  }
}
origin: libgdx/libgdx

public void setEnabled (ParticleEmitter emitter, boolean enabled) {
  ParticleData data = particleData.get(emitter);
  if (data == null) particleData.put(emitter, data = new ParticleData());
  data.enabled = enabled;
  emitter.reset();
}
origin: apache/storm

  @Override
  public void modifyOutputStream(JarOutputStream jarOut) throws IOException {
    for (String key : this.entries.keySet()) {
      jarOut.putNextEntry(new JarEntry(key));
      jarOut.write(this.entries.get(key).getBytes());
    }
  }
}
origin: alibaba/jstorm

public static <V> HashMap<V, Integer> multi_set(List<V> list) {
  HashMap<V, Integer> rtn = new HashMap<V, Integer>();
  for (V v : list) {
    int cnt = 1;
    if (rtn.containsKey(v)) {
      cnt += rtn.get(v);
    }
    rtn.put(v, cnt);
  }
  return rtn;
}
origin: FudanNLP/fnlp

private void calcAV() {
  System.out.println("count: "+left.size());
  Iterator<String> it = left.keySet().iterator();		
  while(it.hasNext()){
    String key = it.next();
    Double l = Math.log(left.get(key).size());
    Double r = Math.log(right.get(key).size());
    av.put(key, (int)Math.min(l, r));
  }
  System.out.println("av count: "+av.size());
}
origin: apache/hive

public void addSeenOp(Task task, Operator operator) {
 List<Operator<?extends OperatorDesc>> seenOps = taskToSeenOps.get(task);
 if (seenOps == null) {
  taskToSeenOps.put(task, seenOps = new ArrayList<Operator<? extends OperatorDesc>>());
 }
 seenOps.add(operator);
}
origin: apache/incubator-dubbo

/**
 * <code><pre>
 * type ::= string
 *      ::= int
 * </code></pre>
 */
private void writeType(String type)
    throws IOException {
  flushIfFull();
  int len = type.length();
  if (len == 0) {
    throw new IllegalArgumentException("empty type is not allowed");
  }
  if (_typeRefs == null)
    _typeRefs = new HashMap();
  Integer typeRefV = (Integer) _typeRefs.get(type);
  if (typeRefV != null) {
    int typeRef = typeRefV.intValue();
    writeInt(typeRef);
  } else {
    _typeRefs.put(type, Integer.valueOf(_typeRefs.size()));
    writeString(type);
  }
}
origin: FudanNLP/fnlp

private void mapKey(int orikey, int key) throws Exception {
  int orivalue = map.get(orikey);
  int value = map.get(key);
  ArrayList<Integer> oriKeyList = mapList.get(orivalue);
  ArrayList<Integer> keyList = mapList.get(value);
  for (Integer temp : oriKeyList) {
    map.put(temp, value);
    keyList.add(temp);
  }
  mapList.remove(orivalue);
}
origin: spring-projects/spring-framework

@Test
public void testGenericMapWithKeyTypeConstructor() {
  DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
  RootBeanDefinition rbd = new RootBeanDefinition(GenericBean.class);
  Map<String, String> input = new HashMap<>();
  input.put("4", "5");
  input.put("6", "7");
  rbd.getConstructorArgumentValues().addGenericArgumentValue(input);
  bf.registerBeanDefinition("genericBean", rbd);
  GenericBean<?> gb = (GenericBean<?>) bf.getBean("genericBean");
  assertEquals("5", gb.getLongMap().get(new Long("4")));
  assertEquals("7", gb.getLongMap().get(new Long("6")));
}
origin: libgdx/libgdx

public final float[] getFloatArray(int argLength) {
 if (!afloats.containsKey(argLength)) {
  afloats.put(argLength, new float[argLength]);
 }
 assert (afloats.get(argLength).length == argLength) : "Array not built with correct length";
 return afloats.get(argLength);
}
origin: libgdx/libgdx

public void setEnabled (ParticleEmitter emitter, boolean enabled) {
  ParticleData data = particleData.get(emitter);
  if (data == null) particleData.put(emitter, data = new ParticleData());
  data.enabled = enabled;
  emitter.reset();
}
java.utilHashMapget

Javadoc

Returns the value of the mapping with the specified key.

Popular methods of HashMap

  • <init>
    Constructs a new HashMap instance containing the mappings from the specified map.
  • put
    Maps the specified key to the specified value.
  • containsKey
    Returns whether this map contains the specified key.
  • keySet
    Returns a set of the keys contained in this map. The set is backed by this map so changes to one are
  • remove
  • entrySet
    Returns a set containing all of the mappings in this map. Each mapping is an instance of Map.Entry.
  • values
    Returns a collection of the values contained in this map. The collection is backed by this map so ch
  • size
    Returns the number of elements in this map.
  • clear
    Removes all mappings from this hash map, leaving it empty.
  • isEmpty
    Returns whether this map is empty.
  • putAll
    Copies all the mappings in the specified map to this map. These mappings will replace all mappings t
  • clone
    Returns a shallow copy of this map.
  • putAll,
  • clone,
  • toString,
  • containsValue,
  • equals,
  • hashCode,
  • computeIfAbsent,
  • getOrDefault,
  • forEach

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setRequestProperty (URLConnection)
  • getResourceAsStream (ClassLoader)
  • putExtra (Intent)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • AtomicInteger (java.util.concurrent.atomic)
    An int value that may be updated atomically. See the java.util.concurrent.atomic package specificati
  • Manifest (java.util.jar)
    The Manifest class is used to obtain attribute information for a JarFile and its entries.
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now