Example usage for java.util HashMap get

List of usage examples for java.util HashMap get

Introduction

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

Prototype

public V get(Object key) 

Source Link

Document

Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key.

Usage

From source file:in.flipbrain.Utils.java

public static boolean auth2Check(String code, String gaClientId) {
    boolean passed = false;
    try {//from   w w  w  . j  a  va 2s. c  o m
        String authCheckJson = httpGet("https://www.googleapis.com/oauth2/v3/tokeninfo?id_token=" + code);
        logger.debug(authCheckJson);
        HashMap jsonObj = gson.fromJson(authCheckJson, HashMap.class);
        passed = jsonObj.get("aud").equals(gaClientId);
    } catch (Exception e) {
        e.printStackTrace();
    }
    return passed;
}

From source file:edu.cornell.mannlib.vitro.webapp.utils.ConceptSearchService.ConceptSearchServiceUtils.java

public static String getConceptSearchServiceClassName(String searchServiceName) {
    HashMap<String, String> map = getMapping();
    if (map.containsKey(searchServiceName)) {
        return map.get(searchServiceName);
    }//from w  w  w  .  java 2  s  .  c  om
    return null;
}

From source file:com.clustercontrol.maintenance.factory.HinemosPropertyInfoCache.java

/**
 * ?/*from   www .ja v a2 s  .c om*/
 * 
 * @param key ?
 * @return 
 */
public static HinemosPropertyInfo getProperty(String key) {
    // ?????????????????????????
    // (?????????????????????????)
    HashMap<String, HinemosPropertyInfo> cache = getCache();
    return cache == null ? null : cache.get(key);
}

From source file:Main.java

public static Element createElement(String name, HashMap<String, Object> attributes) {

    Element e = document.createElement(name);

    for (String a : attributes.keySet())
        if (attributes.get(a) instanceof String)
            e.setAttribute(a, (String) attributes.get(a));

    return e;//from   ww w . java2  s . co  m
}

From source file:Main.java

public static ArrayList<ContentValues> removeEntriesWhenEquals(
        HashMap<String, ArrayList<ContentValues>> operationMap, String tableName, String idColumnName,
        String compareValue) {/*from   ww  w . j  a va 2 s. co  m*/
    ArrayList<ContentValues> restoreOperations = operationMap.get(tableName);
    if (null == restoreOperations || null == compareValue) {
        return null;
    }
    ArrayList<ContentValues> removeOperations = new ArrayList<ContentValues>();
    for (ContentValues restoreCv : restoreOperations) {
        if (restoreCv.containsKey(idColumnName) && compareValue.equals(restoreCv.getAsString(idColumnName))) {
            removeOperations.add(restoreCv);
        }
    }
    for (ContentValues removeCv : removeOperations) {
        restoreOperations.remove(removeCv);
    }
    return removeOperations;
}

From source file:com.nubits.nubot.utils.VersionInfo.java

/**
 * get version from ".nubot file"/*from   w ww.  j a v a2s .  c  om*/
 *
 * @return
 */
public static String getVersionName() {

    if (FilesystemUtils.insideJar()) {
        HashMap km = getInfoFile();
        if (km.containsKey("version")) {
            return "" + km.get("version");
        }

        return "load version error";
    } else {
        String branch = getCurrentgitBranch();
        return branch;
    }
}

From source file:Main.java

/**
 * Check a xml file against a schema./* w w w  .j  av a 2 s.  c o  m*/
 * 
 * @param fileToCheck
 * @param schemURL
 * @throws Exception
 */
static public void schemaCheck(File fileToCheck, URL schemURL) throws Exception {

    final String W3C_SCHEMA_SPEC = "http://www.w3.org/2001/XMLSchema";
    HashMap<String, Schema> MetsSchema = null;

    if (MetsSchema == null) {
        MetsSchema = new HashMap();
    }

    if (MetsSchema.get(schemURL.toString()) == null) {
        // 1. Lookup a factory for the W3C XML Schema language
        SchemaFactory factory = SchemaFactory.newInstance(W3C_SCHEMA_SPEC);

        // 2. Compile the schema. 
        MetsSchema.put(schemURL.toString(), factory.newSchema(schemURL));
    }

    // 3. Get a validator from the schema.
    Validator validator = MetsSchema.get(schemURL.toString()).newValidator();

    // 4. Parse the document you want to check.
    Source source = new StreamSource(fileToCheck);

    // 5. Check the document        
    validator.validate(source);
}

From source file:com.nubits.nubot.utils.VersionInfo.java

public static String getBranchCommitInfo() {
    if (FilesystemUtils.insideJar()) {

        HashMap km = getInfoFile();

        if (km.containsKey("version")) {
            return "" + km.get("version");
        }/*from w  w  w .j a  v  a  2 s .  c  o m*/

        return "load version error";

    } else {
        return getCurrentgitBranch();
    }
}

From source file:Main.java

public static String wrappedContext(HashMap<String, String> context) {
    String _context = "";
    if (context == null) {
        return "";
    }/*from   w w  w  . j  a v  a2 s .  c om*/
    for (String key : context.keySet()) {
        _context += key + ":" + context.get(key) + ",";
    }
    _context = _context.substring(0, _context.length() - 1);
    return _context;
}

From source file:de.zebrajaeger.psdimage.autopano.GPanoData.java

protected static String parseString(HashMap<String, String> map, String name) {
    return map.get(name);
}