Thank you for the info! I am learning this in data structures now and still learning the logic for how to move different nodes around and iterate them via custom iterator code. It is also very helpful that you show how to create/run/debug tests.
Good eye. There's a special shortcut key that you can press when your text cursor is in specific locations. First I placed my text cursor to the left of a method that returns a value. Then I press CTRL+2 (and let go), this brings up a small menu in the bottom right of the screen which gives you a few options. The one option I chose was "L", which is to assign the return value of the method to a (L)ocal variable. But I do it so fast, you don't see the menu pop up. So it's just, CTRL+2, then L
I don't see why not... though in most use cases, checking to see if we have a previous element isn't too practical... we typically start at the beginning and iterate forwards (therefore needing to check for hasNext)
Thank you for the info! I am learning this in data structures now and still learning the logic for how to move different nodes around and iterate them via custom iterator code. It is also very helpful that you show how to create/run/debug tests.
Good explanation of custom iterator. Thanks a lot
You are most welcome
This was crazily helpful - thanks for sharing your experiences :)
In your next() method wont you print out the head twice while traversing?
6:20 what happend here? what dod u press?
Good eye.
There's a special shortcut key that you can press when your text cursor is in specific locations.
First I placed my text cursor to the left of a method that returns a value. Then I press CTRL+2 (and let go), this brings up a small menu in the bottom right of the screen which gives you a few options. The one option I chose was "L", which is to assign the return value of the method to a (L)ocal variable.
But I do it so fast, you don't see the menu pop up.
So it's just, CTRL+2, then L
Would this also work if you need to implement hasPrevious as well?
I don't see why not... though in most use cases, checking to see if we have a previous element isn't too practical... we typically start at the beginning and iterate forwards (therefore needing to check for hasNext)
you need to implement ListIterator for hasNext and hasPrevious those method...iterator doesn't have hasPrevious
And after doing all that, you can use the for-each-loop in your main class, in this case LinkedList, right?
You got it!
very nice explanation, thanks dude!
Loved it, Thanks
Thank you thank you thank you thank you. Subscribed!!!.
thank you awesome vid
Thank you mr beast
my mind shuts off. i wish they would name one iterator and the other something else.
Doesn't use inline curly braces, thumbs down, not a real programmer ;)