public static void main(String[] args) {
String[] a={“1″,”2″,”3”};
String[] b={“Q”,”W”,”E”};
List<String> list = Arrays.asList(a);
List<Map<String,String>> result = new ArrayList<>();
list.stream().forEach(x->{
Map<String,String> map = new HashMap<>();
map.put(“idCard”, x);
map.put(“source”, b[list.indexOf(x)]);//通过下标获取第二个数组的值
result.add(map);
});
System.out.println(JSONObject.toJSONString(result));
//[{“idCard”:”1″,”source”:”Q”},{“idCard”:”2″,”source”:”W”},{“idCard”:”3″,”source”:”E”}] //需要的值
}