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

How to use
size
method
in
java.util.HashMap

Best Java code snippets using java.util.HashMap.size (Showing top 20 results out of 18,090)

Refine searchRefine arrow

  • HashMap.get
  • HashMap.put
  • Map.Entry.getKey
  • Map.Entry.getValue
  • HashMap.entrySet
  • HashMap.keySet
  • HashMap.values
  • HashMap.containsKey
  • HashMap.<init>
  • Collection.toArray
origin: prestodb/presto

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

origin: oblac/jodd

/**
 * Returns all profiles names.
 */
public String[] getAllProfiles() {
  String[] profiles = new String[data.profileProperties.size()];
  int index = 0;
  for (String profileName : data.profileProperties.keySet()) {
    profiles[index] = profileName;
    index++;
  }
  return profiles;
}
origin: apache/flink

@Override
public Map<String, String> toMap() {
  synchronized (this.confData){
    Map<String, String> ret = new HashMap<>(this.confData.size());
    for (Map.Entry<String, Object> entry : confData.entrySet()) {
      ret.put(entry.getKey(), entry.getValue().toString());
    }
    return ret;
  }
}
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: grandcentrix/tray

  @Override
  protected void setUp() throws Exception {
    super.setUp();
    System.setProperty("dexmaker.dexcache",
        "/data/data/" + BuildConfig.APPLICATION_ID + ".test/cache");
    mDataStore = new HashMap<>();
    mDataStore.put(OLD_KEY, DATA);
    assertEquals(1, mDataStore.size());

    mTrayPreference = new MockSimplePreferences(1);
    assertEquals(0, mTrayPreference.getAll().size());
  }
}
origin: geoserver/geoserver

public String[][] getHeaders(Object value, Operation operation) throws ServiceException {
  Response delegate = (Response) value;
  HashMap map = new HashMap();
  if (delegate.getContentDisposition() != null) {
    map.put("Content-Disposition", delegate.getContentDisposition());
  }
  HashMap m = delegate.getResponseHeaders();
  if (m != null && !m.isEmpty()) {
    map.putAll(m);
  }
  if (map == null || map.isEmpty()) return null;
  String[][] headers = new String[map.size()][2];
  List keys = new ArrayList(map.keySet());
  for (int i = 0; i < headers.length; i++) {
    headers[i][0] = (String) keys.get(i);
    headers[i][1] = (String) map.get(keys.get(i));
  }
  return headers;
}
origin: brianfrankcooper/YCSB

private HashMap<String, ByteIterator> extractResult(Document item) {
 if (null == item) {
  return null;
 }
 HashMap<String, ByteIterator> rItems = new HashMap<>(item.getHashMap().size());
 for (Entry<String, Object> attr : item.getHashMap().entrySet()) {
  LOGGER.trace("Result- key: {}, value: {}", attr.getKey(), attr.getValue().toString());
  rItems.put(attr.getKey(), new StringByteIterator(attr.getValue().toString()));
 }
 return rItems;
}
origin: com.h2database/h2

/**
 * Update session meta data information and get the information in a map.
 *
 * @return a map containing the session meta data
 */
HashMap<String, Object> getInfo() {
  HashMap<String, Object> m = new HashMap<>(map.size() + 5);
  m.putAll(map);
  m.put("lastAccess", new Timestamp(lastAccess).toString());
  try {
    m.put("url", conn == null ?
        "${text.admin.notConnected}" : conn.getMetaData().getURL());
    m.put("user", conn == null ?
        "-" : conn.getMetaData().getUserName());
    m.put("lastQuery", commandHistory.isEmpty() ?
        "" : commandHistory.get(0));
    m.put("executing", executingStatement == null ?
        "${text.admin.no}" : "${text.admin.yes}");
  } catch (SQLException e) {
    DbException.traceThrowable(e);
  }
  return m;
}
origin: stackoverflow.com

private HashMap<String, String> mData = new HashMap<String, String>();
private String[] mKeys;
public HashMapAdapter(HashMap<String, String> data){
  mData  = data;
  mKeys = mData.keySet().toArray(new String[data.size()]);
  return mData.size();
  return mData.get(mKeys[position]);
origin: redisson/redisson

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

eForm = s1.isElementFormDefault() || s2.isElementFormDefault();
HashMap m = new HashMap();
for (int i = 0; i < ag1.length; i++) m.put(ag1[i].getName(), ag1[i]);
attributeGroups = new AttributeGroup[m.size()];
Object[] obj = m.values().toArray();
attributes = new Attribute[m.size()];
obj = m.values().toArray();
complexTypes = new ComplexType[m.size()];
obj = m.values().toArray();
simpleTypes = new SimpleType[m.size()];
obj = m.values().toArray();
elements = new Element[m.size()];
obj = m.values().toArray();
groups = new Group[m.size()];
obj = m.values().toArray();
imports = new Schema[m.size()];
obj = m.values().toArray();
origin: com.h2database/h2

/**
 * Get the class id, or null if not found.
 *
 * @param clazz the class
 * @return the class id or null
 */
static Integer getCommonClassId(Class<?> clazz) {
  HashMap<Class<?>, Integer> map = COMMON_CLASSES_MAP;
  if (map.size() == 0) {
    // lazy initialization
    // synchronized, because the COMMON_CLASSES_MAP is not
    synchronized (map) {
      if (map.size() == 0) {
        for (int i = 0, size = COMMON_CLASSES.length; i < size; i++) {
          map.put(COMMON_CLASSES[i], i);
        }
      }
    }
  }
  return map.get(clazz);
}
origin: cmusphinx/sphinx4

  /**
   * Convert a HashMap to string array
   * 
   * @param syms the input HashMap
   * @return the strings array
   */
  public static String[] toStringArray(HashMap<String, Integer> syms) {
    String[] res = new String[syms.size()];
    for (String sym : syms.keySet()) {
      res[syms.get(sym)] = sym;
    }
    return res;
  }
}
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: com.h2database/h2

private static int increment(HashMap<String, Integer> map, String trace,
    int minCount) {
  Integer oldCount = map.get(trace);
  if (oldCount == null) {
    map.put(trace, 1);
  } else {
    map.put(trace, oldCount + 1);
  }
  while (map.size() > MAX_ELEMENTS) {
    for (Iterator<Map.Entry<String, Integer>> ei =
        map.entrySet().iterator(); ei.hasNext();) {
      Map.Entry<String, Integer> e = ei.next();
      if (e.getValue() <= minCount) {
        ei.remove();
      }
    }
    if (map.size() > MAX_ELEMENTS) {
      minCount++;
    }
  }
  return minCount;
}
origin: org.apache.lucene/lucene-core

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

@Override
public Set<Entry<String, Object>> entrySet() {
  Map<String,Object> set = new LinkedHashMap<>(props.size());
  for (Entry<Long,String> se : dictionary.entrySet()) {
    set.put(se.getValue(), props.get(se.getKey()).getValue());
  }
  return Collections.unmodifiableSet(set.entrySet());
}
origin: jMonkeyEngine/jmonkeyengine

protected void generateAlias(String name, byte type) {
  byte alias = (byte) cObj.nameFields.size();
  cObj.nameFields.put(name, new BinaryClassField(name, alias, type));
}
origin: h2oai/h2o-2

@Override void apply(Env env, int argcnt, ASTApply apply) {
 final boolean warn_missing = env.popDbl() == 1;
 final String replace = env.popStr();
 String skey = env.key();
 Frame fr = env.popAry();
 if (fr.numCols() != 1) throw new IllegalArgumentException("revalue works on a single column at a time.");
 String[] old_dom = fr.anyVec()._domain;
 if (old_dom == null) throw new IllegalArgumentException("Column is not a factor column. Can only revalue a factor column.");
 HashMap<String, String> dom_map = hashMap(replace);
 for (int i = 0; i < old_dom.length; ++i) {
  if (dom_map.containsKey(old_dom[i])) {
   old_dom[i] = dom_map.get(old_dom[i]);
   dom_map.remove(old_dom[i]);
  }
 }
 if (dom_map.size() > 0 && warn_missing) {
  for (String k : dom_map.keySet()) {
   env._warnings = Arrays.copyOf(env._warnings, env._warnings.length + 1);
   env._warnings[env._warnings.length - 1] = "Warning: old value " + k + " not a factor level.";
  }
 }
}
origin: plutext/docx4j

int nextId = getAbstractListDefinitions().size();		
do {
  nextId++;            
} while (getAbstractListDefinitions().containsKey( "" + nextId ));    	
abstractNum.setAbstractNumId( BigInteger.valueOf(nextId) );
abstractListDefinitions.put(absNumDef.getID(), absNumDef);
num.setAbstractNumId(abstractNumId);
nextId = getInstanceListDefinitions().size();		
do {
  nextId++;            
} while (getInstanceListDefinitions().containsKey( "" + nextId ));    	
num.setNumId( BigInteger.valueOf(nextId) );  
instanceListDefinitions.put(listDef.getListNumberId(), listDef);
java.utilHashMapsize

Javadoc

The number of mappings in this hash map.

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.
  • values
    Returns a collection of the values contained in this map. The collection is backed by this map so ch
  • 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

  • Updating database using SQL prepared statement
  • getSystemService (Context)
  • findViewById (Activity)
  • scheduleAtFixedRate (Timer)
  • Component (java.awt)
    A component is an object having a graphical representation that can be displayed on the screen and t
  • Font (java.awt)
    The Font class represents fonts, which are used to render text in a visible way. A font provides the
  • Date (java.sql)
    A class which can consume and produce dates in SQL Date format. Dates are represented in SQL as yyyy
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • Reference (javax.naming)
  • JButton (javax.swing)
  • 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