我已将以下 xml 属性存储到
HashMap<String, String> extraParams = new HashMap<String, String>()
<parameter name="sourceAttrStart" value="true" />
<parameter name="user" value="admin" />
<parameter name="password" value="password" />
<parameter name="SQL" value="SELECT * FROM test.users" />
<parameter name="driverClass" value="com.mysql.jdbc.Driver" />
<parameter name="url" value="jdbc:mysql://tesco-db.ce7gg2eo7hdc.us-
<parameter name="sourceAttrEnd" value="true" />
基本上我想在 kets 之间获取哈希图的子sourceAttrStart
集sourceAttrEnd
这就是我正在尝试的
TreeMap<String, String> sorted = new TreeMap<String, String>(extraParams);
SortedMap<String, String> sourceParams = sorted.subMap("sourceAttrStart", "sourceAttrEnd");
但是低于异常,知道为什么吗?
java.lang.IllegalArgumentException: fromKey > toKey
at java.util.TreeMap$NavigableSubMap.<init>(TreeMap.java:1368)
at java.util.TreeMap$AscendingSubMap.<init>(TreeMap.java:1855)
at java.util.TreeMap.subMap(TreeMap.java:913)
at java.util.TreeMap.subMap(TreeMap.java:954)