Java Iterator - In Depth

preview_player
Показать описание
The Java Iterator interface represents a component that can iterate the elements of a Java collection. You can obtain a Java Iterator from a Java List, Java Set, Java Map, or other collection types. You can also implement the Java Iterator interface yourself, to create your own custom Iterator.

Chapters
0:00 Java Iterator introduction
1:30 Iterate elements via a Java Iterator
2:50 Iteration order
4:27 Java Iterator with generic type
5:56 Modifying a collection during iteration
10:44 Remove elements during iteration
12:37 ListIterator
14:44 Implement the Iterator interface in your own class
17:17 Iterator forEachRemaining() method

Java Iterator Tutorial - text

Java Collections Tutorial - text / video

Java Lambda Expressions tutorial - text / video
Рекомендации по теме
Комментарии
Автор

I appreciate that you took the time to give time stamps as to what topics were being discussed in the video, saved me a bunch of time

paulpachikara
Автор

This was very well produced. You did a good job of taking slight deviations to explain other basics, while not diving too far into a rabbit hole on them - that is a difficult tight rope to walk.

I also appreciate that you spoke in a slow and calming tone, that made it easier to ingest the information.

You also did a good job giving links to the difference "chapters" within the video. That's a very helpful feature.

I will be tuning in to more of your videos for certain.

michaelfitzpatrick
Автор

i really love your tutorials. though i am learning, java coding after 10 years in IT industry, your lessons make the basics very strong and then we can build on top of that. thank you from bottom on my heart and sharing your knowledge. hats off to you.

harishankaryadav
Автор

If anyone wondering, why HashSet puts items into seemingly random order.
HashSet generates an int value for each entry, to use it as a key. When item is inserted, the hash function is applied to it, to get an int value, and the item is put into corresponding array position. If we need to get an item from such set, or check if the item is present, the hash gonna be computed for the item, and corresponding position gonna be checked for the item. This provides us with almost constant time for search and insert operations, even on very large sets of data.

aleksanderklepov
Автор

This is probably the best video of Java Iterator in Youtube.
Thank You.

SBala-xklr
Автор

Awesome lesson! I really enjoyed that you went into details about the methods and along with your other Iterable interface video its been very helpful! Will continue to watch more of your content!

booksbybytes
Автор

Thank you Jakob! This tutorial is so helpful! You've really got me understood how an iterator works in a plain and detailed way, my savior on java🤩🥰

penny-iioi
Автор

Good quality content. Surprised your channel doesn't have more subs. Very helpful explanations with good examples.

andreychetvertakov
Автор

Thanks for sharing your knowledge, Jenkov. By the way, may I ask something? I am curious the reason why you change your IDE from eclipse to VSCode.

joonion
Автор

Very helpful and well explained, thanks a lot!

PatchFact
Автор

Ich Küsse dein Auge! Habe beim Panitz nichts verstanden! Toll erklärt

BizziTV
Автор

Thanks for the tutorial, it's really good! However, I do have one question. At minute 11:53, I'm not exactly sure how iterator manages to remove all the elements from the list. When we enter the while loop the first step is to call iterator.next(), the next() will return the "current" element (where the pointer is) and then move the "pointer" to the next one. In our case it would first return Jane, and move the pointer to Heidi. After that we call iterator.remove(). This is where my confusion comes from. The pointer is now at Heidi, but it managed to remove Jane.
How is that possible?

iamnoob
Автор

Perfect explained tutorials. One question. If I wanna iterate through the list, it looks easier to use for each, or for each lambda expression. If I understood correctly, the iterator is used when I wanna remove something.

AndrulisTravel
Автор

Thanks a lot Jakob
not only your name is cool, your video was cool :)

amirbeheshti
Автор

very useful tutorial, thank you. you have earned a sub!

one question:
what is the point of using the Iterator? Why can't we just use our normal for/for-each and while loops to iterate over a collection?

HldThat
Автор

Is Iterator used much these days to iterate through a collection? Using something like a for each loop or the stream API seems more convenient.

abulsyed
Автор

Hi! This tutorial is great! I have a questions:
When we use iterator.previous in a loop, could we remove elements from a list.. we go backward, and the previous element still remain so there will not have a (next)previous exception, Am i right. Yes, you couldn't use the same iterator again and it's obvious you don't need to do this like that...but ?!!!

mayabelemezova
Автор

I don't want to seem rude, but I think your tutorials are a bit too long for the concept you are explaining. Maybe it's just me, but around 15 minutes to me is the right time to describe Iterators

avoiredranger