以下结果是我的HashMap
值,我通过循环子句填充
private Map<String, String> days = new HashMap<>();
0 = {HashMap$HashMapEntry@4952} "2131689719" -> "2016-11-25"
1 = {HashMap$HashMapEntry@4953} "2131689683" -> "2016-11-26"
2 = {HashMap$HashMapEntry@4954} "2131689692" -> "2016-11-27"
3 = {HashMap$HashMapEntry@4955} "2131689686" -> "2016-11-26"
4 = {HashMap$HashMapEntry@4956} "2131689716" -> "2016-12-01"
现在,当我尝试搜索给定键的值时,例如:
days.get("2131689719")
我得到null
int day = 0;
int dateOfWeeks = 10;
for (int i = 0; i <= 6; i++) {
((TextView) findViewById(food_list_values[i])).setText(dayOfWeeks[day]);
days.put(String.valueOf((findViewById(food_list_values[i])).getId()), foodList.get(dateOfWeeks).getDate());
day++;
dateOfWeeks++;
}