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

How to use
values
method
in
java.util.HashMap

Best Java code snippets using java.util.HashMap.values (Showing top 20 results out of 19,080)

Refine searchRefine arrow

  • Iterator.hasNext
  • Iterator.next
  • Collection.iterator
  • HashMap.put
  • HashMap.size
  • HashMap.get
  • Collection.toArray
  • HashMap.<init>
origin: prestodb/presto

/**
 * @since 2.3
 */
public Iterable<Annotation> annotations() {
  if (_annotations == null || _annotations.size() == 0) {
    return Collections.emptyList();
  }
  return _annotations.values();
}

origin: commons-collections/commons-collections

/**
 * Gets the values iterator from the superclass, as used by inner class.
 *
 * @return iterator
 */
Iterator superValuesIterator() {
  return super.values().iterator();
}
origin: redisson/redisson

public CtMethod[] getMethods() {
  HashMap h = new HashMap();
  getMethods0(h, this);
  return (CtMethod[])h.values().toArray(new CtMethod[h.size()]);
}
origin: commons-collections/commons-collections

/**
 * Gets the total size of the map by counting all the values.
 * 
 * @return the total size of the map counting all values
 * @since Commons Collections 3.1
 */
public int totalSize() {
  int total = 0;
  Collection values = super.values();
  for (Iterator it = values.iterator(); it.hasNext();) {
    Collection coll = (Collection) it.next();
    total += coll.size();
  }
  return total;
}
origin: apache/kafka

private static Cluster mockCluster() {
  HashMap<Integer, Node> nodes = new HashMap<>();
  nodes.put(0, new Node(0, "localhost", 8121));
  nodes.put(1, new Node(1, "localhost", 8122));
  nodes.put(2, new Node(2, "localhost", 8123));
  return new Cluster("mockClusterId", nodes.values(),
      Collections.<PartitionInfo>emptySet(), Collections.<String>emptySet(),
      Collections.<String>emptySet(), nodes.get(0));
}
origin: Activiti/Activiti

 HashMap<String, EntityImpl> entityMap = new HashMap<String, EntityImpl>(result.size());
  entityMap.put(entity.getId(), entity);
   EntityImpl cachedEntity = (EntityImpl) cachedObject.getEntity();
   if (cachedEntityMatcher.isRetained(result, cachedObjects, cachedEntity, parameter)) {
    entityMap.put(cachedEntity.getId(), cachedEntity); // will overwite db version with newer version
     EntityImpl cachedSubclassEntity = (EntityImpl) subclassCachedObject.getEntity();
     if (cachedEntityMatcher.isRetained(result, cachedObjects, cachedSubclassEntity, parameter)) {
      entityMap.put(cachedSubclassEntity.getId(), cachedSubclassEntity); // will overwite db version with newer version
 result = entityMap.values();
Iterator<EntityImpl> resultIterator = result.iterator();
while (resultIterator.hasNext()) {
 if (getDbSqlSession().isEntityToBeDeleted(resultIterator.next())) {
  resultIterator.remove();
origin: stackoverflow.com

 HashMap<Integer, String> map = new HashMap<Integer, String>();
map.put (1, "Mark");
map.put (2, "Tarryn");
List<String> list = new ArrayList<String>(map.values());
for (String s : list) {
  System.out.println(s);
}
origin: AltBeacon/android-beacon-library

/**
 * The following code is for dealing with merging data fields in beacons
 */
@Nullable
private Beacon trackGattBeacon(@NonNull Beacon beacon) {
  if (beacon.isExtraBeaconData()) {
    updateTrackedBeacons(beacon);
    return null;
  }
  String key = getBeaconKey(beacon);
  HashMap<Integer,Beacon> matchingTrackedBeacons = mBeaconsByKey.get(key);
  if (null == matchingTrackedBeacons) {
    matchingTrackedBeacons = new HashMap<>();
  }
  else {
    Beacon trackedBeacon = matchingTrackedBeacons.values().iterator().next();
    beacon.setExtraDataFields(trackedBeacon.getExtraDataFields());
  }
  matchingTrackedBeacons.put(beacon.hashCode(), beacon);
  mBeaconsByKey.put(key, matchingTrackedBeacons);
  return beacon;
}
origin: fesh0r/fernflower

HashMap<Integer, Node> mapNodes = new HashMap<>();
 mapNodes.put(stat.id, new Node(stat.id));
 Node node = mapNodes.get(stat.id);
  Node nodeSucc = mapNodes.get(succ.id);
 Node node = null;
 for (Node nd : mapNodes.values()) {
  if (nd.succs.contains(nd)) { // T1
   ttype = 1;
   Node pred = node.preds.iterator().next();
  return mapNodes.size() > 1; // reducible iff one node remains
origin: ch.qos.logback/logback-classic

  @SuppressWarnings("unchecked")
  public Appender<ILoggingEvent> getAppender() {
    Map<String, Object> omap = interpreter.getInterpretationContext().getObjectMap();
    HashMap<String, Appender<?>> appenderMap = (HashMap<String, Appender<?>>) omap.get(ActionConst.APPENDER_BAG);
    oneAndOnlyOneCheck(appenderMap);
    Collection<Appender<?>> values = appenderMap.values();
    if (values.size() == 0) {
      return null;
    }
    return (Appender<ILoggingEvent>) values.iterator().next();
  }
}
origin: apache/zookeeper

/**
 * This method pre-computes the weights of groups to speed up processing
 * when validating a given set. We compute the weights of groups in 
 * different places, so we have a separate method.
 */
private void computeGroupWeight(){
  for (Entry<Long, Long> entry : serverGroup.entrySet()) {
    Long sid = entry.getKey();
    Long gid = entry.getValue();
    if(!groupWeight.containsKey(gid))
      groupWeight.put(gid, serverWeight.get(sid));
    else {
      long totalWeight = serverWeight.get(sid) + groupWeight.get(gid);
      groupWeight.put(gid, totalWeight);
    }
  }
  
  /*
   * Do not consider groups with weight zero
   */
  for(long weight: groupWeight.values()){
    LOG.debug("Group weight: " + weight);
    if(weight == ((long) 0)){
      numGroups--;
      LOG.debug("One zero-weight group: " + 1 + ", " + numGroups);
    }
  }
}

origin: org.apache.lucene/lucene-core

 FieldInfos finish() {
  finished = true;
  return new FieldInfos(byName.values().toArray(new FieldInfo[byName.size()]));
 }
}
origin: spotbugs/spotbugs

  public void foo() {

    m.put("a", "a");
    Set<Map.Entry<Integer, Integer>> es = new HashSet<Map.Entry<Integer, Integer>>();
    boolean b1 = m.entrySet().contains(1); // bad
    boolean b2 = m.keySet().contains(1); // ok
    boolean b3 = m.values().contains(1); // ok
    boolean b4 = m.entrySet().equals(es); // ok
    boolean b5 = m.entrySet().equals(is); // bad
    m.entrySet().contains(1); // bad
    boolean b6 = m.keySet().equals(is); // ok
    boolean b7 = m.values().equals(is); // ok
    System.out.printf("%b %b %b %b %b %b %b\n", b1, b2, b3, b4, b5, b6, b7);
  }
}
origin: com.h2database/h2

private void removeOldTempIndexes() {
  if (tempObjects != null) {
    metaObjects.putAll(tempObjects);
    for (PageIndex index: tempObjects.values()) {
      if (index.getTable().isTemporary()) {
        index.truncate(pageStoreSession);
        index.remove(pageStoreSession);
      }
    }
    pageStoreSession.commit(true);
    tempObjects = null;
  }
  metaObjects.clear();
  metaObjects.put(-1, metaIndex);
}
origin: wildfly/wildfly

/**
 * Gets the total size of the map by counting all the values.
 * 
 * @return the total size of the map counting all values
 * @since Commons Collections 3.1
 */
public int totalSize() {
  int total = 0;
  Collection values = super.values();
  for (Iterator it = values.iterator(); it.hasNext();) {
    Collection coll = (Collection) it.next();
    total += coll.size();
  }
  return total;
}
origin: apache/kafka

private static Cluster mockCluster(int controllerIndex) {
  HashMap<Integer, Node> nodes = new HashMap<>();
  nodes.put(0, new Node(0, "localhost", 8121));
  nodes.put(1, new Node(1, "localhost", 8122));
  nodes.put(2, new Node(2, "localhost", 8123));
  return new Cluster("mockClusterId", nodes.values(),
      Collections.emptySet(), Collections.emptySet(),
      Collections.emptySet(), nodes.get(controllerIndex));
}
origin: org.drools/drools-core

@Test
public void testJUHashMap3() {
  final int count = 100000;
  final java.util.HashMap map = new java.util.HashMap();
  assertNotNull( map );
  for ( int idx = 0; idx < count; idx++ ) {
    final String key = "key" + idx;
    final String strval = "value" + idx;
    map.put( key,
         strval );
  }
  final long start = System.currentTimeMillis();
  final java.util.Iterator itr = map.values().iterator();
  while ( itr.hasNext() ) {
    itr.next().hashCode();
  }
  final long end = System.currentTimeMillis();
  System.out.println( "java.util.HashMap iterate ET - " + ((end - start)) );
}
origin: prestodb/presto

public static AnnotationMap merge(AnnotationMap primary, AnnotationMap secondary)
{
  if (primary == null || primary._annotations == null || primary._annotations.isEmpty()) {
    return secondary;
  }
  if (secondary == null || secondary._annotations == null || secondary._annotations.isEmpty()) {
    return primary;
  }
  HashMap<Class<?>,Annotation> annotations = new HashMap<Class<?>,Annotation>();
  // add secondary ones first
  for (Annotation ann : secondary._annotations.values()) {
    annotations.put(ann.annotationType(), ann);
  }
  // to be overridden by primary ones
  for (Annotation ann : primary._annotations.values()) {
    annotations.put(ann.annotationType(), ann);
  }
  return new AnnotationMap(annotations);
}

origin: opentripplanner/OpenTripPlanner

  this.coordinates.put(v.getCoordinate(), iV);
  this.vertices.put(iV, new Vertex(iV, v.getCoordinate()));
  iV++;
HashMap<QuadEdge, Double> qeDistances = new HashMap<QuadEdge, Double>();
for (QuadEdge qe : quadEdges) {
  qeDistances.put(qe, qe.toLineSegment().getLength());
  s.normalize();
  Integer idS = this.coordinates.get(s.p0);
  Integer idD = this.coordinates.get(s.p1);
  Vertex oV = this.vertices.get(idS);
  Vertex eV = this.vertices.get(idD);
for (Edge edge : this.edges.values()) {
  if (edge.getTriangles().size() > 1) {
    Triangle tA = edge.getTriangles().get(0);
for (Edge e : this.shortLengths.values()) {
  LineString l = e.getGeometry().toGeometry(this.geomFactory);
  edges.add(l);
LineString merge = (LineString)lineMerger.getMergedLineStrings().iterator().next();
origin: scouter-project/scouter

public CtMethod[] getMethods() {
  HashMap h = new HashMap();
  getMethods0(h, this);
  return (CtMethod[])h.values().toArray(new CtMethod[h.size()]);
}
java.utilHashMapvalues

Javadoc

Returns a collection of the values contained in this map. The collection is backed by this map so changes to one are reflected by the other. The collection supports remove, removeAll, retainAll and clear operations, and it does not support add or addAll operations.

This method returns a collection which is the subclass of AbstractCollection. The iterator method of this subclass returns a "wrapper object" over the iterator of map's entrySet(). The sizemethod wraps the map's size method and the contains method wraps the map's containsValue method.

The collection is created when this method is called for the first time and returned in response to all subsequent calls. This method may return different collections when multiple concurrent calls occur, since no synchronization is performed.

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.
  • get
    Returns the value of the mapping with the specified key.
  • 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.
  • 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 Sublime Text 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