# What is the time complexity of contains() of a Set view?

If I have a TreeSet and I use contains() on the Set view of keySet() is the time complexity O(1)? Map<String, Integer> map1 = new TreeMap<>(); map1.keySet().contains(xyz); I am wondering as for example contains() for HashSet and LinkedHashSet is O(1) but for a TreeSet is O(log(N)) but the keySet() method is not returning a HashSet,… Read More What is the time complexity of contains() of a Set view?