250x250
Notice
Recent Posts
Recent Comments
| 일 | 월 | 화 | 수 | 목 | 금 | 토 |
|---|---|---|---|---|---|---|
| 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 |
Tags
- 오픈소스
- JavaScript
- Tomcat
- Python
- SpringBoot
- Docker
- Source
- MSSQL
- MySQL
- maven
- myBatis
- oracle
- spring
- JDBC
- PostgreSQL
- STS
- Exception
- git
- error
- ubuntu
- Open Source
- Thymeleaf
- Spring Boot
- 설정
- 문서
- jpa
- IntelliJ
- Eclipse
- AJAX
- Core Java
Archives
- Today
- Total
헤르메스 LIFE
[Core Java] Map or List에 값이 포함되어 있는지 확인 본문
728x90
public static void main(String[] args) { Map<string> map = new HashMap<string>(); map.put("A", "aaa"); map.put("B", "bbb"); map.put("C", "ccc"); map.put("D", "ddd"); map.put("E", "eee"); map.put("F", "fff"); String key = "D"; String value = "eee"; if(map.containsKey(key)){ System.out.println("find key ["+key+"]"); }else{ System.out.println("not find key ["+key+"]"); } if(map.containsValue(value)){ System.out.println("find value ["+value+"]"); }else{ System.out.println("not find value ["+value+"]"); }}출력 결과는 아래와 같습니다.
find key [D]
find value [eee]
728x90
'Core Java' 카테고리의 다른 글
| [Applet] Java Applet Tutorial (1) | 2013.07.24 |
|---|---|
| Web 개발환경 설정 (1) | 2013.06.24 |
| [OpenSource] 토비 Spring 3 - ConfigurableDispatcherServlet (0) | 2012.06.22 |
| [Source] Common Java Cookbook (0) | 2012.06.20 |
| [Source] EncodingFilter.java (0) | 2012.05.15 |