Here you can find the source of putMapBooleanList(Map
public static Map<String, Object> putMapBooleanList(Map<String, Object> params, String... keys)
//package com.java2s; /*//from w w w. j a v a 2 s. c o m * * ***************************************************************************** * * Copyright ( c ) 2016 Heren Tianjin Inc. All Rights Reserved. * * * * This software is the confidential and proprietary information of Heren Tianjin Inc * * ("Confidential Information"). You shall not disclose such Confidential Information * * and shall use it only in accordance with the terms of the license agreement * * you entered into with Heren Tianjin or a Heren Tianjin authorized * * reseller (the "License Agreement"). * **************************************************************************** * */ import java.util.Arrays; import java.util.HashMap; import java.util.Map; public class Main { public static Map<String, Object> putMapBooleanList(Map<String, Object> params, String... keys) { Map<String, Object> resultMap = new HashMap<>(); Arrays.stream(keys).filter(key -> params.containsKey(key) && !params.get(key).equals("")) .forEach(key -> resultMap.put(change(key), params.get(key))); return resultMap; } private static String change(String param) { if (param.contains("_")) { String[] split = param.split("_"); StringBuilder sb = new StringBuilder(split[0]); for (int i = 1; i < split.length; i++) { sb.append(split[i].substring(0, 1).toUpperCase()).append(split[i].substring(1)); } return sb.toString(); } else { return param; } } }