UserOrder是实体类型 id是里面的一个字段
1. List→Map
Map<String, UserOrder> maps = ulist.stream() .collect(Collectors.toMap(UserOrder::getId, Function.identity(), (key1, key2) -> key2));
2.Map→List
terator<Entry<String, UserOrder>> iter = maps.entrySet().iterator();
while (iter.hasNext()) {
Entry<String, UserOrder> entry = iter.next();
st.add((UserOrder) entry.getValue());
}
jar 用的都是 java.util.*