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

How to use
keySet
method
in
java.util.HashMap

Best Java code snippets using java.util.HashMap.keySet (Showing top 20 results out of 24,417)

Refine searchRefine arrow

  • HashMap.get
  • HashMap.put
  • Iterator.hasNext
  • Iterator.next
  • Set.iterator
origin: redisson/redisson

  public Iterator<String> keyIterator() {
    if ( values == null ) {
      return emptyIter;
    }
    return values.keySet().iterator();
  }
}
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: 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 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: apache/hive

@Override
public MapJoinKey getAnyKey() {
 return mHash.isEmpty() ? null : mHash.keySet().iterator().next();
}
origin: Sable/soot

 @Override
 protected void merge(HashMap<Value, Integer> in1, HashMap<Value, Integer> in2, HashMap<Value, Integer> out) {
  // Copy over in1. This will be the baseline
  out.putAll(in1);

  // Merge in in2. Make sure that we do not have ambiguous values.
  for (Value val : in2.keySet()) {
   Integer i1 = in1.get(val);
   Integer i2 = in2.get(val);
   if (i2.equals(i1)) {
    out.put(val, i2);
   } else {
    throw new RuntimeException("Merge of different IDs not supported");
   }
  }
 }
}
origin: Atmosphere/atmosphere

  public Enumeration<String> getInitParameterNames() {
    if (!done.getAndSet(true)) {
      Enumeration en = sc.getInitParameterNames();
      if (en != null) {
        while (en.hasMoreElements()) {
          String name = (String) en.nextElement();
          if (!initParams.containsKey(name)) {
            initParams.put(name, sc.getInitParameter(name));
          }
        }
      }
    }
    return Collections.enumeration(initParams.keySet());
  }
};
origin: apache/drill

/**
 * 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: iSoron/uhabits

public void copyScoresFrom(@NonNull CacheData oldData)
{
  for (Long id : id_to_habit.keySet())
  {
    if (oldData.scores.containsKey(id))
      scores.put(id, oldData.scores.get(id));
    else scores.put(id, 0.0);
  }
}
origin: apache/drill

@Override
public MapJoinKey getAnyKey() {
 return mHash.isEmpty() ? null : mHash.keySet().iterator().next();
}
origin: commons-collections/commons-collections

/**
 * Convenience method for getting an iterator over the keys.
 * <p>
 * Write-only properties will not be returned in the iterator.
 *
 * @return an iterator over the keys
 */
public Iterator keyIterator() {
  return readMethods.keySet().iterator();
}
origin: kaushikgopal/RxJava-Android-Samples

private List<String> mapAsList(HashMap<String, Long> map) {
 List<String> list = new ArrayList<>();
 for (String username : map.keySet()) {
  String rowLog = String.format("%s [%d]", username, contributionMap.get(username));
  list.add(rowLog);
 }
 return list;
}
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: 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: 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: iSoron/uhabits

public void copyCheckmarksFrom(@NonNull CacheData oldData)
{
  int[] empty = new int[checkmarkCount];
  for (Long id : id_to_habit.keySet())
  {
    if (oldData.checkmarks.containsKey(id))
      checkmarks.put(id, oldData.checkmarks.get(id));
    else checkmarks.put(id, empty);
  }
}
origin: apache/hive

private static void addBucketsToResultsCommon(
  HashMap<String, FileStatus> taskIDToFile, int numBuckets, List<Path> result) {
 String taskID1 = taskIDToFile.keySet().iterator().next();
 Path bucketPath = taskIDToFile.values().iterator().next().getPath();
 for (int j = 0; j < numBuckets; ++j) {
  addBucketFileIfMissing(result, taskIDToFile, taskID1, bucketPath, j);
 }
}
origin: NanoHttpd/nanohttpd

@Override
public Iterator<String> iterator() {
  return this.cookies.keySet().iterator();
}
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: JetBrains/ideavim

@Nullable
private HashMap<Character, Mark> getAllFileMarks(@NotNull final Document doc) {
 VirtualFile vf = FileDocumentManager.getInstance().getFile(doc);
 if (vf == null) {
  return null;
 }
 HashMap<Character, Mark> res = new HashMap<>();
 FileMarks<Character, Mark> fileMarks = getFileMarks(doc);
 if (fileMarks != null) {
  res.putAll(fileMarks);
 }
 for (Character ch : globalMarks.keySet()) {
  Mark mark = globalMarks.get(ch);
  if (vf.getPath().equals(mark.getFilename())) {
   res.put(ch, mark);
  }
 }
 return res;
}
java.utilHashMapkeySet

Javadoc

Returns a set view of the keys contained in this 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.
  • 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 plugins for Android Studio
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