Example usage for java.util Map keySet

List of usage examples for java.util Map keySet

Introduction

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

Prototype

Set<K> keySet();

Source Link

Document

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

Usage

From source file:org.craftercms.social.migration.util.scripting.ScriptUtils.java

public static NativeObject toJSObject(Map map) {
    final NativeObject toReturn = new NativeObject();
    for (Object key : map.keySet()) {
        toReturn.defineProperty(key.toString(), map.get(key), NativeObject.READONLY);
    }/*from w ww.  j  a  v  a2s . c om*/
    return toReturn;
}

From source file:com.redhat.victims.util.VictimsConfig.java

/**
 * Set configuration options for victims-lib
 *
 * @link https://github.com/victims/victims-lib-java#configuration-options
 *//*  w w w  .  ja v a  2 s . c o  m*/
public static void configureVictimsOptions() {

    Map<String, String> config = VictimsConfig.getProperties();

    for (String key : config.keySet()) {
        //only set from properties if no JVM option
        if (StringUtils.isBlank(System.getProperty(key)) && StringUtils.isNotBlank(config.get(key))) {
            System.setProperty(key, config.get(key));
        }
    }

}

From source file:com.zimbra.cs.account.PreAuthKey.java

public static String computePreAuth(Map<String, String> params, String key) {
    TreeSet<String> names = new TreeSet<String>(params.keySet());
    StringBuilder sb = new StringBuilder();
    for (String name : names) {
        if (sb.length() > 0)
            sb.append('|');
        sb.append(params.get(name));//from ww w.j  a  v a2 s  .  c  om
    }
    return getHmac(sb.toString(), key.getBytes());
}

From source file:Main.java

public static void broadcast(Context context, String action, Map<String, String> params) {
    Intent intent = new Intent(action);
    if (params != null) {
        Set<String> keys = params.keySet();
        for (String string : keys) {
            intent.putExtra(string, params.get(string));
        }//from  w  ww.  j  ava  2 s  . c o  m
    }
    context.sendBroadcast(intent);
}

From source file:Main.java

public static String getCreateTableSql(String name, Map<String, String> columns) {
    String ret = "CREATE TABLE " + name + " (";
    int counter = 0;
    for (String key : columns.keySet()) {
        counter++;/*from www.  j  a v a2  s . c  om*/
        ret += key + " " + columns.get(key);
        if (counter < columns.size()) {
            ret += ", ";
        }
    }
    ret += ")";

    return ret;
}

From source file:com.emobc.android.profiling.Profile.java

public static List<NameValuePair> createNamedParameters(Context context) {
    List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>();
    SharedPreferences settings = getProfileData(context);
    Map<String, ?> map = settings.getAll();
    for (String key : map.keySet()) {
        final String value = map.get(key).toString();
        if (value != null && value.length() > 0) {
            nameValuePairs.add(new BasicNameValuePair(key, value));
        }//  w  w w.  j  ava 2s .c o  m
    }
    return nameValuePairs;
}

From source file:edu.cornell.mannlib.vitro.webapp.web.AntiScript.java

/**
 * Method to clean all of the values in a map where the values are of
 * type String.//  w w w .  j  a va  2s .  c om
 */
public static <T> void cleanMapValues(Map<T, String> map) {
    for (T key : map.keySet()) {
        map.put(key, cleanText(map.get(key)));
    }
}

From source file:net.jcreate.e3.table.skin.processor.VelocityHelper.java

public static VelocityContext context2VelocityContext(Context pContext) {
    if (pContext == null) {
        return null;
    }//from w w w . ja v a  2s  .  c o  m
    VelocityContext result = new VelocityContext();
    Map params = pContext.getParameters();
    for (Iterator i = params.keySet().iterator(); i.hasNext();) {
        String key = (String) i.next();
        Object value = params.get(key);
        result.put(key, value);
    }
    return result;
}

From source file:Main.java

private static List<Map<String, String>> getKeys(Map<String, Integer> score, Integer value,
        List<Map<String, String>> all) {
    Iterator<String> iter = score.keySet().iterator();
    List<Map<String, String>> result = new ArrayList<Map<String, String>>();
    while (iter.hasNext()) {
        String next = iter.next();
        if (score.get(next).equals(value)) {
            Map<String, String> o = getFromFsNumber(next, all);
            if (o != null)
                result.add(o);//from   w  w  w.  ja va  2s.c om
        }
    }

    return result;
}

From source file:edu.toronto.cs.xml2rdf.freebase.FreebaseUtil.java

private static String manipulateQuery(String query, Map<String, String> params) {
    String manipulate_query = query;
    for (String key : params.keySet()) {
        manipulate_query = query.replace("%" + key + "%", params.get(key));
    }/* ww w  . java 2  s .co m*/
    return manipulate_query;
}