collapse single-entry probability collections to singletons

This commit is contained in:
dfsek 2022-06-17 16:28:32 -07:00
parent 21ec335db9
commit 4dd43ea86d

View File

@ -49,6 +49,14 @@ public class ProbabilityCollectionLoader implements TypeLoader<ProbabilityCollec
}
} else if(o instanceof List) {
List<Map<Object, Object>> map = (List<Map<Object, Object>>) o;
if(map.size() == 1) {
Map<Object, Object> entry = map.get(0);
if(entry.size() == 1) {
for(Object value : entry.keySet()) {
return new ProbabilityCollection.Singleton<>(configLoader.loadType(generic, value, depthTracker));
}
}
}
for(int i = 0; i < map.size(); i++) {
Map<Object, Object> l = map.get(i);
for(Entry<Object, Object> entry : l.entrySet()) {