Example usage for java.util Map entrySet

List of usage examples for java.util Map entrySet

Introduction

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

Prototype

Set<Map.Entry<K, V>> entrySet();

Source Link

Document

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

Usage

From source file:com.test.edusys.common.utils.SearchFilter.java

/**
 * searchParamskey?OPERATOR_FIELDNAME/* w w  w. j a  v a 2  s .c  o  m*/
 */
public static Map<String, SearchFilter> parse(Map<String, Object> searchParams) {
    Map<String, SearchFilter> filters = new HashMap();

    for (Entry<String, Object> entry : searchParams.entrySet()) {
        // 
        String key = entry.getKey();
        Object value = entry.getValue();
        System.out.println(value);
        if (StringUtils.isBlank((String) value)) {
            continue;
        }

        // operatorfiledAttribute
        String[] names = StringUtils.split(key, "@");
        if (names.length != 2) {
            throw new IllegalArgumentException(key + " is not a valid search filter name");
        }
        String filedName = names[1];
        Operator operator = Operator.valueOf(names[0]);

        // searchFilter
        SearchFilter filter = new SearchFilter(filedName, operator, value);
        filters.put(key, filter);
    }

    return filters;
}

From source file:com.bonc.mr_roamRecognition_hjpt.comm.PathCombineTextInputFormat.java

public synchronized static List<PathFilter> getPoll() {

    List<PathFilter> pools = new ArrayList<PathFilter>();
    Map<String, String> map = ProvUtil.getCode();

    for (Map.Entry<String, String> entry : map.entrySet()) {
        final String prov_id = entry.getValue();
        pools.add(new PathFilter() {
            String provId = prov_id;

            @Override/*ww w  .j a  va 2  s .  co  m*/
            public boolean accept(Path path) {
                String fileName = path.getParent().toString();
                boolean need = fileName.endsWith(prov_id);
                return need;
            }
        });
    }

    return pools;
}

From source file:de.christianseipl.utilities.maputils.MapPrinting.java

public static <K, L, V> void printTwoDimensionalMap(String _header, Map<K, Map<L, V>> _map) {
    System.out.println(_header);/*from ww w .j  a  v  a 2s  .  c om*/
    for (Entry<K, Map<L, V>> first : _map.entrySet()) {
        System.out.println(first.getKey().toString());
        for (Entry<L, V> second : first.getValue().entrySet()) {
            System.out.println(String.format("%20s\t%20s\t%20s", first.getKey().toString(),
                    second.getKey().toString(), second.getValue().toString()));
        }
        System.out.println();
    }
    System.out.println();
}

From source file:Main.java

/**
 * Dumps XML attributes out to the specified writer
 *
 * @param out the writer// w  w  w .  j  a v  a  2s.  c  o  m
 * @param attributes the attributes
 * @throws IOException
 */
public static void dumpAttributes(Writer out, Map attributes) throws IOException {
    if ((attributes == null) || (attributes.isEmpty())) {
        return;
    }

    Iterator it = attributes.entrySet().iterator();
    Map.Entry me;
    String value;

    while (it.hasNext()) {
        me = (Map.Entry) it.next();
        value = (String) me.getValue();

        if (value != null) {
            out.write(' ');
            out.write((String) me.getKey());
            out.write("=\"");
            out.write(value);
            out.write('"');
        }
    }
}

From source file:org.gephi.statistics.plugin.ChartUtils.java

public static XYSeries createXYSeries(Map data, String name) {
    XYSeries series = new XYSeries(name);
    for (Iterator it = data.entrySet().iterator(); it.hasNext();) {
        Map.Entry d = (Map.Entry) it.next();
        Number x = (Number) d.getKey();
        Number y = (Number) d.getValue();
        series.add(x, y);//from ww w . ja v  a 2 s .  c o m
    }
    return series;
}

From source file:com.ciwen.xhb.cms.common.persistence.SearchFilter.java

/**
 * searchParamskey?OPERATOR_FIELDNAME//  w w w.java2 s  .com
 */
public static Map<String, SearchFilter> parse(Map<String, Object> searchParams) {
    Map<String, SearchFilter> filters = Maps.newHashMap();

    for (Entry<String, Object> entry : searchParams.entrySet()) {
        // 
        String key = entry.getKey();
        Object value = entry.getValue();
        if (StringUtils.isBlank(String.valueOf(value))) {
            continue;
        }

        // operatorfiledAttribute
        String[] names = StringUtils.split(key, "_");
        if (names.length != 2) {
            throw new IllegalArgumentException(key + " is not a valid search filter name");
        }
        String filedName = names[1];
        Operator operator = Operator.valueOf(names[0]);

        // searchFilter
        SearchFilter filter = new SearchFilter(filedName, operator, value);
        filters.put(key, filter);
    }

    return filters;
}

From source file:com.wxt.news.persistence.SearchFilter.java

/**
 * searchParamskey?OPERATOR_FIELDNAME/*ww  w . jav a  2s  .  co m*/
 */
public static Map<String, SearchFilter> parse(Map<String, Object> searchParams) {
    Map<String, SearchFilter> filters = Maps.newHashMap();

    for (Entry<String, Object> entry : searchParams.entrySet()) {
        // 
        String key = entry.getKey();
        Object value = entry.getValue();
        if (value == null || (value instanceof String && StringUtils.isBlank((String) value))) {
            continue;
        }

        // operatorfiledAttribute
        String[] names = StringUtils.split(key, "_");
        if (names.length != 2) {
            throw new IllegalArgumentException(key + " is not a valid search filter name");
        }
        String filedName = names[1];
        Operator operator = Operator.valueOf(names[0]);

        // searchFilter
        SearchFilter filter = new SearchFilter(filedName, operator, value);
        filters.put(key, filter);
    }

    return filters;
}

From source file:at.wada811.utils.DumpUtils.java

public static String toString(SharedPreferences preferences) {
    if (preferences == null) {
        return "null";
    }// w ww .  j  a v a2  s .  c o m
    JSONObject json = new JSONObject();
    Map<String, ?> map = preferences.getAll();
    for (Entry<String, ?> entry : map.entrySet()) {
        try {
            json.put(entry.getKey(), DumpUtils.toString(entry.getValue()));
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
    return json.toString();
}

From source file:io.cloudslang.lang.entities.utils.MapUtils.java

public static Map<String, Value> convertMapNonSensitiveValues(Map<String, ? extends Serializable> source) {
    Map<String, Value> target = new HashMap<>(source.size());
    for (Map.Entry<String, ? extends Serializable> entry : source.entrySet()) {
        target.put(entry.getKey(), ValueFactory.create(entry.getValue()));
    }/*ww  w  .  j a va  2s.c  o  m*/
    return target;
}

From source file:Main.java

private static void setHeader(HttpUriRequest request, Map<String, String> headers) {
    if (headers == null || headers.size() == 0) {
        throw new NullPointerException("headers not be null");
    }//from  www . j  av  a2 s  .  com
    for (Entry<String, String> entry : headers.entrySet()) {
        request.addHeader(entry.getKey(), entry.getValue());
    }
}