There is code :
List<Integer> al = new ArrayList<>() ;
Iterator iterator = al.iterator();
System.out.println(iterator.getClass().getName());
I get :
java.util.ArrayList$Itr
What does it mean: "ArrayList$Itr" ?
What implementation of Iterator i get in this line ?
Iterator iterator = al.iterator();
Inside the ArrayList class, the following inner class is defined:
private class Itr implements Iterator<E> {...}
al.iterator() returns an instance of that class, whose full name is java.util.ArrayList$Itr.
public Iterator<E> iterator() {
return new Itr();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With