diff --git a/src/main/java/com/microsoft/spring/data/gremlin/conversion/result/AbstractGremlinResultReader.java b/src/main/java/com/microsoft/spring/data/gremlin/conversion/result/AbstractGremlinResultReader.java index 1b7881b1..25657fa8 100644 --- a/src/main/java/com/microsoft/spring/data/gremlin/conversion/result/AbstractGremlinResultReader.java +++ b/src/main/java/com/microsoft/spring/data/gremlin/conversion/result/AbstractGremlinResultReader.java @@ -12,7 +12,7 @@ import org.springframework.util.Assert; import java.util.ArrayList; -import java.util.LinkedHashMap; +import java.util.List; import java.util.Map; @NoArgsConstructor @@ -22,20 +22,19 @@ public abstract class AbstractGremlinResultReader { /** * properties's organization is a little complicated. *

- * properties is LinkedHashMap + * properties is Map * K is String * V is ArrayList - * T is LinkedHashMap + * T is Map */ private Object readProperty(@NonNull Object value) { Assert.isInstanceOf(ArrayList.class, value, "should be instance of ArrayList"); - @SuppressWarnings("unchecked") final ArrayList> mapList - = (ArrayList>) value; + final List listValue = (List) value; + Assert.isTrue(listValue.size() == 1, "should be only 1 element in ArrayList"); + final Map map = (Map) listValue.get(0); - Assert.isTrue(mapList.size() == 1, "should be only 1 element in ArrayList"); - - return mapList.get(0).get(Constants.PROPERTY_VALUE); + return map.get(Constants.PROPERTY_VALUE); } protected void readResultProperties(@NonNull Map properties, @NonNull GremlinSource source) {