Skip to content

Commit c1c8d82

Browse files
1.2.1
1 parent cfd0d14 commit c1c8d82

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<groupId>com.github.developframework</groupId>
66
<artifactId>expression</artifactId>
7-
<version>1.2.2-SNAPSHOT</version>
7+
<version>1.2.1-SNAPSHOT</version>
88

99
<name>Expression Framework</name>
1010
<url>https://github.com/developframework/expression</url>

src/main/java/com/github/developframework/expression/ExpressionUtils.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@
33
import com.github.developframework.expression.exception.ExpressionException;
44

55
import java.lang.reflect.Field;
6-
import java.util.List;
7-
import java.util.Map;
8-
import java.util.Objects;
6+
import java.util.*;
97

108
/**
119
* 表达式取值工具
@@ -124,8 +122,12 @@ private static final Object getValueFromArray(Object instance, ArrayExpression a
124122
return ((Object[]) arrayObject)[arrayExpression.getIndex()];
125123
} else if (List.class.isAssignableFrom(clazz)) {
126124
return ((List) arrayObject).get(arrayExpression.getIndex());
125+
} else if (Set.class.isAssignableFrom(clazz)) {
126+
ArrayList arrayList = new ArrayList<>((Set) arrayObject);
127+
arrayList.sort(Comparator.comparingInt(Object::hashCode));
128+
return arrayList.get(arrayExpression.getIndex());
127129
} else {
128-
throw new ExpressionException("The instance \"%s\" type is not array or List.", instance.toString());
130+
throw new ExpressionException("The instance \"%s\" type is not array or List/Set.", instance.toString());
129131
}
130132
}
131133

0 commit comments

Comments
 (0)