hasNext() merely tells you if there is another element in the collection that you can iterate over. next() actually returns said element. The initial position of the cursor is before the first element.
For example, assume you had the following:
0 1 2 3 4
| 8 | 5 | 2 | 3 | 7 |
The cursor is actually pointing to a location before the first element:
0 1 2 3 4
| 8 | 5 | 2 | 3 | 7 |
^
|
cursor
When you do hasNext(), it checks to see if there is anything at location cursor + 1. If you have an empty list, there is nothing at cursor + 1 (i.e., nothing at index 0), so it will return false. If you are at the very last element, cursor + 1 == list.size() which means there is nothing after the end of the list. If you are anywhere else in the list, cursor + 1 is a valid index that is populated, so it will return true.
When you actually do next(), it will advance the cursor and return the element at the new position. Now, the cursor is in a new location where it is before the next element.
Now it really doesn't even matter how it is being done internally. The cursor could be pointing to the very first element the first time. If that is the case, all you would need is special logic to handle that scenario (perhaps a flag that checks to see if next() has ever been called).
All you need to understand in the case of an Iterator is that hasNext() will tell you if there is an element remaining that you can iterate over, and next() will return that element. This behavior is consistent across invocations and should be consistent across all implementations.
nextin order to get the first object.