Example usage for java.util HashMap put

List of usage examples for java.util HashMap put

Introduction

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

Prototype

public V put(K key, V value) 

Source Link

Document

Associates the specified value with the specified key in this map.

Usage

From source file:com.nuance.expertassistant.InvokeQACoreAPI.java

public static String getProjectStatus(String projectID) {
    HashMap<String, String> paramMap = new HashMap<String, String>();
    paramMap.put("projectId", projectID);
    url = LoadConfig.getValueFromFile("QACORE_URL", "https://db.tt/hVkpsluN");
    String localurl = url + "getProjectStatus";
    try {/* w  w  w .ja va 2  s  .co m*/
        String str = HTTPConnection.sendPost(localurl, paramMap);
        return str;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

From source file:com.nuance.expertassistant.InvokeQACoreAPI.java

public static String deleteProject(String projectID) {
    HashMap<String, String> paramMap = new HashMap<String, String>();
    paramMap.put("projectId", projectID);
    url = LoadConfig.getValueFromFile("QACORE_URL", "https://db.tt/hVkpsluN");
    String localurl = url + "deleteProject";
    try {//  w w w  . jav  a2 s  .c o m
        String str = HTTPConnection.sendPost(localurl, paramMap);
        return "OK";
    } catch (Exception e) {
        e.printStackTrace();
    }
    return "NO";
}

From source file:com.github.jobs.api.GithubJobsApi.java

public static boolean subscribe(String email, String description, String location, boolean fullTime) {
    HashMap<String, String> parameters = new HashMap<String, String>();
    parameters.put(SUBSCRIPTION_EMAIL_PARAM, email);
    parameters.put(SUBSCRIPTION_DESCRIPTION_PARAM, description);
    parameters.put(SUBSCRIPTION_LOCATION_PARAM, location);
    parameters.put(SUBSCRIPTION_FULL_TIME_PARAM, String.valueOf(fullTime));
    String response = HttpHandler.getInstance().postRequest(ApiConstants.EMAIL_SUBSCRIPTION_URL, parameters);
    return SUBSCRIPTION_OK_PARAM.equals(response);
}

From source file:functionaltests2.SchedulerCommandLine.java

public static void killSchedulerCmdLine() {
    HashMap<String, String> env = new HashMap<String, String>();
    env.put("SchedulerTStarter", "SchedulerTStarter");

    // and eventually we kill remaining nodes
    try {/*from   ww  w . ja va2 s  . co m*/
        ProcessTree.get().killAll(p, env);
        Thread.sleep(3000);
    } catch (InterruptedException e) {
        e.printStackTrace();
    }
    //p.destroy();
}

From source file:com.hangum.tadpole.rdb.core.util.CubridExecutePlanUtils.java

/**
 * cubrid plan? text    ? ? <??>  ?.
 * /*from   w  w w .j  av a2 s  .  c om*/
 * @param data
 * @return
 */
public static List<HashMap<Integer, Object>> getMakeData(String data) {
    List<HashMap<Integer, Object>> sourceDataList = new ArrayList<HashMap<Integer, Object>>();

    HashMap<Integer, Object> tmpRs = new HashMap<Integer, Object>();
    tmpRs.put(0, data);
    sourceDataList.add(tmpRs);

    return sourceDataList;
}

From source file:com.shmsoft.dmass.print.Html2Pdf.java

/**
 * Bad rendering, perhaps used only for Windows
 *//*from  ww  w.  j a  va2s  .  c o  m*/
@SuppressWarnings({ "rawtypes", "unchecked" })
private static void convertHtml2Pdf(Reader htmlReader, String outputFile) throws Exception {
    Document pdfDocument = new Document();

    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PdfWriter.getInstance(pdfDocument, baos);
    pdfDocument.open();
    StyleSheet styles = new StyleSheet();
    styles.loadTagStyle("body", "font", "Times New Roman");

    ImageProvider imageProvider = new ImageProvider() {

        @Override
        public Image getImage(String src, HashMap arg1, ChainedProperties arg2, DocListener arg3) {

            try {
                Image image = Image.getInstance(IOUtils.toByteArray(
                        getClass().getClassLoader().getResourceAsStream(ParameterProcessing.NO_IMAGE_FILE)));
                return image;
            } catch (Exception e) {
                System.out.println("Problem with html->pdf imaging, image provider fault");
            }

            return null;
        }

    };

    HashMap interfaceProps = new HashMap();
    interfaceProps.put("img_provider", imageProvider);

    ArrayList arrayElementList = HTMLWorker.parseToList(htmlReader, styles, interfaceProps);
    for (int i = 0; i < arrayElementList.size(); ++i) {
        Element e = (Element) arrayElementList.get(i);
        pdfDocument.add(e);
    }
    pdfDocument.close();
    byte[] bs = baos.toByteArray();
    File pdfFile = new File(outputFile);
    FileOutputStream out = new FileOutputStream(pdfFile);
    out.write(bs);
    out.close();
}

From source file:Main.java

public static HashMap<String, Integer> getMostFrequentDestination(ArrayList<String> destination) {
    System.out.println("ARRAYLIST INPUT! : " + destination.size());
    HashMap<String, Integer> temp = new HashMap<String, Integer>();
    for (String d : destination) {
        if (temp.containsKey(d)) {
            temp.put(d, temp.get(d) + 1);
        } else {/*from  w w w  . ja va  2  s  . com*/
            temp.put(d, 1);
        }
    }
    return temp;
}

From source file:edu.cornell.mannlib.vitro.webapp.controller.individual.IndividualController.java

private static Map<String, Float> initializeContentTypes() {
    HashMap<String, Float> map = new HashMap<String, Float>();
    map.put(HTML_MIMETYPE, 0.5f);
    map.put(XHTML_MIMETYPE, 0.5f);//from   ww w . ja  va  2s .co m
    map.put("application/xml", 0.5f);
    map.put(JSON_MIMETYPE, 1.0f);
    map.put(JSON_LD_MIMETYPE, 1.0f);
    map.put(RDFXML_MIMETYPE, 1.0f);
    map.put(RDFXML_MIMETYPE, 1.0f);
    map.put(N3_MIMETYPE, 1.0f);
    map.put(TTL_MIMETYPE, 1.0f);
    return Collections.unmodifiableMap(map);
}

From source file:com.nuance.expertassistant.InvokeQACoreAPI.java

public static String getAnswer(String ContextID, String ProjectID, String QuestionText) {
    HashMap<String, String> paramMap = new HashMap<String, String>();
    paramMap.put("contextId", ContextID);
    url = LoadConfig.getValueFromFile("QACORE_URL", "https://db.tt/hVkpsluN");
    // paramMap.put("projectId", ProjectID);
    paramMap.put("question", QuestionText);

    String localURL = url + "question";

    try {/*  ww w.ja  v a  2 s . c  o m*/
        String answerString = HTTPConnection.sendPost(localURL, paramMap);
        //String jsonResponse = "{\"response\":" + jsonString + "}";
        //JSONObject object = new JSONObject(jsonResponse);
        return answerString;
    } catch (Exception e) {
        e.printStackTrace();
    }
    return null;
}

From source file:at.tuwien.ifs.somtoolbox.util.CollectionUtils.java

public static HashMap<String, Integer> getOrCreateValue(HashMap<Integer, HashMap<String, Integer>> map,
        Integer key) {/*from  w w  w  .  j a  v  a 2 s.  c  o  m*/
    if (map.get(key) == null) {
        map.put(key, new HashMap<String, Integer>());
    }
    return map.get(key);
}