diff --git a/build.gradle b/build.gradle index 431b658..47e6d6b 100644 --- a/build.gradle +++ b/build.gradle @@ -6,7 +6,7 @@ plugins { } group = 'it.fulminazzo' -version = '1.5.13' +version = '1.5.14' repositories { mavenCentral() diff --git a/src/main/java/it/fulminazzo/yamlparser/configuration/IConfiguration.java b/src/main/java/it/fulminazzo/yamlparser/configuration/IConfiguration.java index 1c5c49d..9631857 100644 --- a/src/main/java/it/fulminazzo/yamlparser/configuration/IConfiguration.java +++ b/src/main/java/it/fulminazzo/yamlparser/configuration/IConfiguration.java @@ -829,11 +829,22 @@ default boolean isList(@NotNull String path) { default @Nullable List getList(@NotNull String path, @NotNull Class clazz) { List list = getObjectList(path); if (list == null) return null; - return list.stream() - .map(o -> o == null ? null : clazz.isAssignableFrom(o.getClass()) ? clazz.cast(o) : - convertObjectToYAMLObject(path, o, clazz)) - .filter(o -> check(path, o, clazz)) - .collect(Collectors.toList()); + List actualList = new LinkedList<>(); + for (int i = 0; i < list.size(); i++) { + Object o = list.get(i); + if (o == null) actualList.add(null); + else { + final T t; + if (clazz.isAssignableFrom(o.getClass())) t = clazz.cast(o); + else { + String p = path + "." + i; + t = convertObjectToYAMLObject(p, o, clazz); + check(p, t, clazz); + } + actualList.add(t); + } + } + return actualList; } /**