October 2018
Intermediate to advanced
370 pages
9h 15m
English
The collection interface is the main interface that represents a collection of items. The collection interface is a member of the immutable type of list and therefore provides read-only functionalities. The collection interface inherits the Iterable interface and provides its own functions:
fun collectionInterface(){ val collectionValues : Collection <Int> = listOf(1,2,3,4,5) val collectionIterator = collectionValues.iterator() while (collectionIterator.hasNext()) { print(collectionIterator.next()) } }
Take a look at the following diagram, which shows the properties and functions that are provided by the collection interface:
The following is a list of the properties and functions of the collection interface:
Read now
Unlock full access