【发布时间】:2016-07-18 09:44:04
【问题描述】:
Map<String, String> map = new HashMap<String, String>();
ObservableList<Object> row2 = FXCollections.observableArrayList();
try {
connected();
String sql = "SELECT `20`.startdate, `20`.enddate, `20`.number FROM `20`";
ResultSet rs = statement.executeQuery(sql);
while(rs.next()){
String sd = rs.getString(3);
LocalDate std = rs.getDate(1).toLocalDate();
LocalDate end = rs.getDate(2).toLocalDate();
while (!std.equals(end)) {
std = std.plusDays(1);
String st = std.toString();
map.put(sd,st);
}
}
closed();}
catch(Exception e){}
我创建了一张新地图。然后我把值放到地图上。但是地图会覆盖一些值吗?为什么?不增加
【问题讨论】:
-
如果键相同,那么它将覆盖以前的值
-
一种更传统的缩进方法可以让你的代码更容易被帮助你的人阅读。
-
有些值是一样的
标签: java dictionary hashmap