diff --git a/datastructures-common/src/main/java/org/xbib/datastructures/common/Maps.java b/datastructures-common/src/main/java/org/xbib/datastructures/common/Maps.java index 12ad6cd..30790ab 100644 --- a/datastructures-common/src/main/java/org/xbib/datastructures/common/Maps.java +++ b/datastructures-common/src/main/java/org/xbib/datastructures/common/Maps.java @@ -14,6 +14,17 @@ public class Maps { private Maps() { } + @SuppressWarnings("unchecked") + public static List> getListMap(Map map, String key) { + Object o = get(map, key); + if (o instanceof List) { + return (List>) o; + } else if (o instanceof Map) { + return List.of((Map) o); + } + return List.of(); + } + @SuppressWarnings({"unchecked"}) public static Map deepMerge(Map map, Map newMap) { for (Map.Entry e : newMap.entrySet()) { @@ -102,7 +113,7 @@ public class Maps { } } else if (oo instanceof List) { List l = (List) oo; - return (T) l.get(0); + return (T) l; } else { return (T) oo; }