Here you can find the source of invert(Map
public static List<Map<String, Object>> invert(Map<String, Object> map, String prefix)
//package com.java2s; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; public class Main { public static List<Map<String, Object>> invert(Map<String, Object> map, String prefix) { List<Map<String, Object>> list = new ArrayList<>(); for (Map.Entry<String, Object> entry : map.entrySet()) { if (entry.getKey().startsWith(prefix)) { String key = entry.getKey().substring(prefix.length()); if (Iterable.class.isAssignableFrom(entry.getValue().getClass())) { int i = 0; for (Object e : ((Iterable) entry.getValue())) { for (int j = list.size(); j <= i; j++) { list.add(new HashMap<String, Object>()); }/*from ww w . j a v a2s . com*/ list.get(i).put(key, e); i++; } } else { if (list.isEmpty()) { list.add(new HashMap<String, Object>()); } list.get(0).put(key, entry.getValue()); } } } return list; } }