// 맵 선언
Map<String, Object> roomList = new HashMap<String, Object>();
// 맵(roomList) 출력 형태 : Key, Value
// 안쪽에서 조건 값 줄 수 있음
roomList.forEach((key, value) -> {
System.out.println("Key : " + key + " Value : " + value);
});
private static void roomSearuch(ArrayList<Object> roomList) {
Room tempRoom = new Room();
for (Object roomFor : roomList) {
tempRoom = (Room) roomFor; // 임시 템프 객체에 룸리스트에서 빼온 객체를 담는다
if (tempRoom.isReserVation()) {
if (tempRoom.getRoomNum() % 10 == 0) {
System.out.println();
System.out.println();
}
System.out.print("[" + tempRoom.getRoomNum() + "]" + "번 가능 :");
}
}
}
}
참고자료
https://hianna.tistory.com/573 (Map)
https://byungmin.tistory.com/12 (ArrayList)
'IT > Java' 카테고리의 다른 글
[JAVA] ArrayList 클래스 활용 (0) | 2024.05.30 |
---|---|
[JAVA] Reader 클래스 활용 (2) | 2024.05.29 |