首页 > 代码库 > JAVA8

JAVA8

1.

Map<Integer, Boolean> answerMap = new HashMap<>();for (Answer answer : answerList) {    answerMap.put(answer.getId(), answer.getAnswer());}Map<Integer,  Boolean> answerMap = new HashMap<>();answerList.forEach((answer) -> answerMap.put(answer.getId(), answer.getAnswer()));

 

JAVA8