티스토리 뷰
Map에서 Key가 있는지 없는지 확인 [ containsKey ]
public class mapContainsKey {
public static void main(String[] args) {
HashMap<String, String> hashMap = new HashMap<String, String>();
hashMap.put("A","아프리카");
hashMap.put("B","브라질");
hashMap.put("C","체코");
hashMap.put("D","덴마크");
System.out.println(hashMap.containsKey("A")); // true
System.out.println(hashMap.containsKey("E")); // false
}
}
Map에서 Value가 있는지 확인 [containsValue]
public class mapContainsValue {
public static void main(String[] args) {
HashMap<String, String> hashMap = new HashMap<String, String>();
hashMap.put("A","아프리카");
hashMap.put("B","브라질");
hashMap.put("C","체코");
hashMap.put("D","덴마크");
System.out.println(hashMap.containsValue("브라질")); // true
System.out.println(hashMap.containsValue("영국")); // false
}
}
'Project > Java' 카테고리의 다른 글
[JAVA] 문자열 연결 방법 비교 (0) | 2020.08.20 |
---|---|
[JAVA] 스트림 Stream 사용방법 (0) | 2020.08.20 |
[JAVA] 진수변환 (0) | 2020.08.13 |
[JavaUtil]Java Date 관련 유틸 (0) | 2008.07.26 |
[JavaUtil]java mail HTML메일 발송 (0) | 2008.07.26 |
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
- Total
- Today
- Yesterday
링크
TAG
- 마이바티스
- letencrypt
- Intellj들여쓰기
- SSL
- camelcase
- 인증서자동갱신
- letsencrypt
- Letsencrypt+nginx
- Letsencrypt wildcard
- 마이바티스CamelCase
- 인증서설치
- elk8.x
- Letsencrypt wildcard auto renew
- #logback
- nginx
- SSL인증서
- logstash
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | ||||
4 | 5 | 6 | 7 | 8 | 9 | 10 |
11 | 12 | 13 | 14 | 15 | 16 | 17 |
18 | 19 | 20 | 21 | 22 | 23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 | 31 |
글 보관함