October 2018
Intermediate to advanced
370 pages
9h 15m
English
The mutable iterator extends from the iterator interface as well. As indicated by its name, this iterator works with mutable lists and can help to remove the underlying item in the list.
Take a look the following diagram of the MutableIterator interface, which inherits the Iterator interface:

This interface provides only one function, which is remove(). This function removes the current element of the list.
The following example removes all items that are equal to 3:
fun mutableIterator(){ val mutableListValues : MutableList<Int> = mutableListOf(1,2,3,4,5) val mutableIterator : MutableIterator<Int> = mutableListValues.listIterator() ...Read now
Unlock full access