Jun's Development Journey

[Tip_Java] 해시맵 전체 검색 본문

Algorithm/Code Tip

[Tip_Java] 해시맵 전체 검색

J_Jayce 2021. 3. 2. 17:02
package Practice;
import java.util.*;
public class Main {
	
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		HashMap<String,String> hash = new HashMap<String,String>();
		hash.put("baby", "아가");
		hash.put("love", "사랑");
		hash.put("apple", "사과");
		
		Set<String> keys = hash.keySet();
		Iterator<String> it = keys.iterator();
		while(it.hasNext()) {
			String key = it.next();
			String value = hash.get(key);
			System.out.println("Key : "+key+", Value : "+value);
		}
	}

}

'Algorithm > Code Tip' 카테고리의 다른 글

[Tip_Java] Priority Queue 사용법  (0) 2021.04.14
[Tip_Java] TreeMap 사용법  (0) 2021.04.13
[Tip_Java] HashMap 사용법  (0) 2021.04.13
[Tip_Java] TreeSet 사용법  (0) 2021.04.13
[Tip_Java] HashSet 사용법  (0) 2021.04.13