Java Iterable

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

Chapters
0:00 Java Iterable introduction
1:20 Ways to iterate the elements of an Iterable
1:37 Iterate Iterable using the Java for-each loop
2:30 Iterate Iterable using an Iterator obtained from the Iterable
2:57 Iterate Iterable by calling its forEach() method
3:30 Obtain Spliterator from Iterable
3:55 Java Iterable implementations
4:45 Java Iterable interface definition
6:07 Implement Iterable in your own class
7:59 Usage of your own Iterable implementation
10:33 Java Iterable performance

Java Iterable tutorial - text

Java Iterator tutorial - text / video

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

Thank you! As I'm reading my textbook (Data Structure in Java) for class it made mention of the Iterable interface (I knew nothing about) and I needed some knowledge. Very helpful video!

reynaldosilva
Автор

Exactly what i was looking for :D Thanks alot!

inMyArtz
Автор

The performance trick you show not only works "only for Lists" but really "only for ArrayLists" I think -- if you were actually using a LinkedList the indexing code would work but be a disaster, right?

jvsnyc
Автор

Hello Jakob. In the performance section, you explain that in each iteration of the loop an Interator object is created in order to "iterate" through the collection. Is that so, since, I think that only 1 Iterator object is created and IT loops through the collection. Creating a new object on each iteration sounds quite inefficient.

menchomenchev
Автор

Question - What is the real life use-case to use Iterable? I feel it's a bit tough to understand Iterable as compared to Iterator. Is it that if you have to build your custom set of objects (i.e. for example an arraylist of class 'animals') and use iterator on that arraylist - then we need this concept of Iterable implementation?

_graymatter__
Автор

Thanks for the video, is there a difference b/w Collection<String> collection = new HashSet<>(); & Set<String> list = new HashSet<>(); Collection<String> collection = list; ?

rock_
Автор

How does your forEach know to iterate through your 'elements' member? does forEach call .iterable() under the hood?

lambmaster
Автор

What is the difference between using iterator.stream().foreach and iterator.foreach? actually Im using java 11

andycode
Автор

what key combination u press on 9:20???

churchofhigherpower._.
Автор

u just go to the code right ahead, i still dontk now what Iterable or iterator is in java

philipT