mirror of
https://github.com/emirpasic/gods.git
synced 2026-06-16 16:26:36 +03:00
- iterator last on all structures with reversible iterators
This commit is contained in:
@@ -149,6 +149,14 @@ func (iterator *Iterator) Reset() {
|
||||
iterator.index = -1
|
||||
}
|
||||
|
||||
// Last moves the iterator to the last element and returns true if there was a last element in the container.
|
||||
// If Last() returns true, then last element's index and value can be retrieved by Index() and Value().
|
||||
// Modifies the state of the iterator.
|
||||
func (iterator *Iterator) Last() bool {
|
||||
iterator.index = iterator.stack.Size()
|
||||
return iterator.Prev()
|
||||
}
|
||||
|
||||
// String returns a string representation of container
|
||||
func (stack *Stack) String() string {
|
||||
str := "ArrayStack\n"
|
||||
|
||||
Reference in New Issue
Block a user