I am intrigued by something that looks obvoius, but it's not for me. We have a hashSet and Iterator:
Set<String> set = new HashSet<>();
Iterator it = set.iterator();
I know, how iterator works, but there's something weird to me:
Iterator* it = set.iterator();**
* ok, wait. Iterator is an interface, not a class. So... ?
** ok, set is an object of class HashSet, and it implements interface Iterator, so ith has void interator() imlemented, nothing unusual.
But how can we create Iterator object from Iterator interface ?