How can I access a element of a IReadOnlyCollection through it index?
Use the ElementAt(int) function with the index value. Here is the MSDN link to the ElementAt(int) function https://msdn.microsoft.com/en-us/library/bb299233(v=vs.110).aspx
Use the ElementAt(int) function with the index value. Here is the MSDN link to the ElementAt(int) function https://msdn.microsoft.com/en-us/library/bb299233(v=vs.110).aspx
You can’t modify a Collection while iterating over it using an Iterator, except for Iterator.remove(). However, if you use the listIterator() method, which returns a ListIterator, and iterate over that you have more options to modify. From the javadoc for add(): The new element is inserted before the implicit cursor: … a subsequent call to … Read more
The differences are listed in the Javadoc for ListIterator You can iterate backwards obtain the iterator at any point. add a new value at any point. set a new value at that point.