[Data Structure] HashMap put

­Valentine·2022년 12월 11일
0

CS

목록 보기
23/23

HashMap에서 Put은 입력뿐만 아니라 수정도 되어 편리하다.

 HashMap<Integer, Team> map = new HashMap<>();
 map.put(1, "개");       
 map.put(1, "오리");       

위의 코드처럼 같은 key값에 중복하여 put하면 가장 마지막 value가 출력된다.

profile
천체관측이 취미

0개의 댓글