Java Iterable vs Iterator tutorial and code

preview_player
Показать описание

In this video I implement a wrapper over a list which implements the iterable interface and creates a new iterator class. I then show how to use the for loop shorthand to loop over our own custom collection class.
Рекомендации по теме
Комментарии
Автор

Surfed all YouTube and then I came across this video. Thank you, it is a very good explanation.

SwapnilRajput
Автор

Classes just went online and my cs professor decided now is a good time to give less direct answers than when we would meet face to face a few times a week. Her help to me not being able to understand why I couldn’t iterate through a generic arraylist using a for each loop but a regular for loop works fine was that it should work and if not I should be able to find a solution online. This was amazing ty

eladesorviews
Автор

Somebody has well said "hands-on trial is way better than reading".
Great explanation 🔥🔥

saurabhkumatkar
Автор

Shouldn't the logic in hasNext be: " if ( internalList.size() > indexPosition + 1 ) " ?? And not " >= " ? If the size is also equal to the position + 1, that means we are at the end of the list, and there is no next element. Example : we have a list of two things, ["bob", "jane"]. The size would be 2. If we are at index 1 in Java, we are at the 2nd element ("jane"). If the "size" (2) is equal to "index + 1" (2) your code says that it hasNext or has another element, which isn't the case.

sparkfx
Автор

Thank you so much. I exactly have been looking for such video! I learned a lot.

thestarinthesky_
Автор

Hi, Aaron, you are the best teacher of all Ukrainian programming teachers on the YouTube, I am from Ukraine, thank you for this lesson, it was very interesting for me.

ntdxoci
Автор

thank you this was extremly clear, best video I found about this topic (:

daloshy
Автор

Great tutorial, very straight forward.

williamchisholm
Автор

Sweet, cleared things up for me. Thanks.

conradlarrson
Автор

I have watched this video several times and every time I learnt something new and existing, informative that I REALLY wanted to know. That's why I wanted to say thank again. Thank you so much teacher. You are THE BEST!

thestarinthesky_
Автор

0:22 Iterable(I) uses "iterator" method to provide Iterator(I).
1:20 implement manually
10:19 enhanced for loop

tmzpanda
Автор

Thank you for the help! You made this concept click!

collinwilliams
Автор

Thanks for the video. (I am sure I heard a train in the background! :))

apoozeo
Автор

ok and i guess you don't need a class to implement iterator if you only need the default next and hasNext behavior because the List class has it's own iterator() method that returns a Iterator. So in public Iterator<T> iterator() method you can just return MyList.iterator();

seal
Автор

this was a very disent tutorial. Do you have a tutorial on customizing the desktop enviorment?

ylioo
Автор

thank you so much, this video saved my ass!
i love you dude!

blabla
Автор

How would I iterate starting from last index to first index?

randy
Автор

lol my man is takin the key board out back and boxing the shit out of it other than this gr8 tut

spider
Автор

u say in the intro that u gonna keep talking about the collecation interface, where can i find that vid?

philipT
Автор

Hmm, I think it would be helpful if there was a simple description of what they are first. By your definition, there's an interface that has a method which is also an interface. ...see what I mean?

deli