Java의 TreeMap에 값이 있는지 확인

Java의 TreeMap에 키와 연결된 값이 있는지 확인하려면 containsKey()  TreeMap.
public boolean containsValue(Object val): 이 메서드는 TreeMap에 찾고 있는 값의 인스턴스가 하나 이상 포함되어 있으면 true 부울을 반환하고, 그렇지 않으면 false를 반환합니다. 이 메소드는 Java 버전 1.2.

import java.util.*; 

public class Recherche_valeur_treemap {
public static void main(String[] args) {
// TreeMap
TreeMap을 만듭니다< 문자열, 문자열> treemap = 새 TreeMap< 문자열, 문자열> ();

// treemap treemap.put("1", "a");
treemap.put("2", "b");
treemap.put("3", "c");
treemap.put("4", "d");
treemap.put("5", "e");

//주요 요소 및 값 표시
Set set=treemap.keySet();
반복자 반복자 = set.iterator();
while(iterator.hasNext()){
문자열 키 = ((문자열) iterator.next());
현 val = ((문자열) treemap.get(key));
System.out.println(키+"-> "+val);
}

부울 존재 = treemap.containsValue("a");
System.out.println("목록에 값 a가 존재함: "+exists);

존재 = treemap.containsValue("f");
System.out.println("f 값이 목록에 있음: "+exists);

}
}
출력:

1-> a
2-> b
3-> c
4-> d
5-> e
a 값이 목록에 있습니다: true
f 값이 목록에 있습니다: false
References:
JavaDoc: TreeMap containsValue() 메서드