Abstract
- A OOP language that is Statically Typed & Strongly Typed. It also provides some features of the functional paradigms but it isn’t very elegant
The Mother of All Classes
java.lang.Object
is the root of all classes in Java. Whether they are part of the Java libraries or custom classes you create yourself, all classes implicitly inherit fromjava.lang.Object
Java Iterator
- An OOP Object of the
java.util.Iterator
OOP Class that can be used to loop through collections likeArrayList
andHashSet
Obtaining a Java Iterator
Iterator<T> it = cars.iterator();
, wherecars
is an instance of Java collections.
Get the first element of a collection using Java iterator
it.next();
returns the first element of a collection, whereit
is a Java iterator.
Loop through a collection using Java iterator
while(it.hasNext()) {System.out.println(it.next());}
, whereit
is a Java iterator.
Remove an element from a collection using Java iterator
it.remove();
, whereit
is a Java iterator.