Example usage for java.util HashMap keySet

List of usage examples for java.util HashMap keySet

Introduction

In this page you can find the example usage for java.util HashMap keySet.

Prototype

public Set<K> keySet() 

Source Link

Document

Returns a Set view of the keys contained in this map.

Usage

From source file:nl.wur.plantbreeding.logic.jfreechart.PieChart.java

/**
 * Returns a PieDataset from a HashMap "String", "Integer".
 * @param distrib HashMap containing the key as key and the count as value
 * @return a PieDataset//from w  ww.  jav a 2s .c  o  m
 */
public final PieDataset createDataset(final HashMap<String, Integer> distrib) {
    DefaultPieDataset dataset = new DefaultPieDataset();
    Set<String> keys = distrib.keySet();
    Iterator<String> kit = keys.iterator();
    while (kit.hasNext()) {
        String key = kit.next();
        dataset.setValue(key, distrib.get(key));
    }
    return dataset;
}

From source file:nl.wur.plantbreeding.logic.jfreechart.PieChart.java

/**
 * Return a PieDataset from a HashMap of String, List where the
 * key is the key used for the pie chart and the size of the list
 * is used for the section of the pie.// ww w.ja  v  a 2s.c o  m
 * @param map a HashMap of String: List of String
 * @return a PieDataset
 */
public final PieDataset createDatasetFromArray(final HashMap<String, List<String>> map) {
    DefaultPieDataset dataset = new DefaultPieDataset();
    Iterator<String> keys = map.keySet().iterator();
    while (keys.hasNext()) {
        String key = keys.next();
        dataset.setValue(key, new Double((map.get(key)).size()));
    }
    return dataset;
}

From source file:com.dubture.symfony.core.builder.AbstractSymfonyVisitor.java

@SuppressWarnings("rawtypes")
private void indexParameters(HashMap<String, String> parameters) {
    Iterator it = parameters.keySet().iterator();
    while (it.hasNext()) {
        String key = (String) it.next();
        String value = parameters.get(key);
        if (key.isEmpty() || value.isEmpty()) {
            continue;
        }//w ww. j ava2 s  .  com
        try {
            indexer.addParameter(key, value, path);
        } catch (Exception e) {
            Logger.logException(e);
        }
    }
}

From source file:com.intel.hadoop.graphbuilder.preprocess.mapreduce.CreateGraphMR.java

/**
 * Set the user defined options./*from   w  ww. ja v a 2  s  .  c om*/
 * 
 * @param userOpts
 *          a Map of option key value pairs.
 */
public void setUserOptions(HashMap<String, String> userOpts) {
    Set<String> s = userOpts.keySet();
    for (String key : s)
        conf.set(key, userOpts.get(key.toString()));
}

From source file:LoginUI.java

private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) throws ParseException {
    HashMap<String, String> userpw = getUserInfo();
    Set<String> users = userpw.keySet();
    RegisterUI register = new RegisterUI(users);
    register.setVisible(true);//from   w  ww  .  j a  v  a  2 s.c  o m
}

From source file:com.ibm.xsp.xflow.activiti.ActivitiRestClient.java

protected void addVariablesToJsonRequest(HashMap<String, Object> variables, JSONObject jsRequest)
        throws JSONException {
    if (variables != null) {
        Iterator<String> it = variables.keySet().iterator();
        while (it.hasNext()) {
            String key = it.next();
            Object value = (Object) variables.get(key);
            jsRequest.put(key, value);/* w w  w .ja v  a 2 s  .c  o  m*/
        }
    }
}

From source file:org.openmeetings.app.data.flvrecord.FlvRecordingLogDaoImpl.java

public Long addFLVRecordingLog(String msgType, FlvRecording flvRecording, HashMap<String, String> returnMap) {
    try {//from ww w.jav  a 2s. co  m

        String exitValue = returnMap.get("exitValue").toString();

        String fullMessage = "";

        for (Iterator<String> iter = returnMap.keySet().iterator(); iter.hasNext();) {
            String key = iter.next();
            String value = returnMap.get(key);
            fullMessage += key + "-" + value + "<br/>";
        }

        FlvRecordingLog flvRecordingLog = new FlvRecordingLog();

        flvRecordingLog.setInserted(new Date());
        flvRecordingLog.setExitValue(exitValue);
        flvRecordingLog.setFlvRecording(flvRecording);
        flvRecordingLog.setFullMessage(fullMessage);
        flvRecordingLog.setMsgType(msgType);

        flvRecordingLog = em.merge(flvRecordingLog);
        Long flvRecordingLogId = flvRecordingLog.getFlvRecordingLogId();

        return flvRecordingLogId;
    } catch (Exception ex2) {
        log.error("[addFLVRecordingLog]: ", ex2);
    }
    return -1L;
}

From source file:kmi.taa.core.SmallSetAnalyser.java

public double std(HashMap<Integer, Double> map) {
    double[] va = new double[map.size()];
    int i = 0;// ww  w .  jav  a2s .c  o  m
    for (Integer k : map.keySet()) {
        va[i++] = map.get(k).doubleValue();
    }
    DescriptiveStatistics ds = new DescriptiveStatistics(va);
    return ds.getStandardDeviation();
}

From source file:GUI.ResponseStatistics.java

private PieDataset createDatasetMultipleChoice(HashMap<String, Double> hm) {
    DefaultPieDataset result = new DefaultPieDataset();

    Set<String> set = hm.keySet();

    for (String s : set) {
        result.setValue(s, hm.get(s));//from www .j  a  va 2  s. co  m
    }

    return result;

}

From source file:GUI.ResponseStatistics.java

private PieDataset createDatasetOneWord(HashMap<String, Double> hm) {
    DefaultPieDataset result = new DefaultPieDataset();

    Set<String> set = hm.keySet();

    for (String s : set) {
        result.setValue(s, hm.get(s));/*  w w w  . ja v  a 2  s.c om*/
    }

    return result;

}