OrderedList

This class encapsulates a list that is ordered Unfortunately, if the element is changed after being added to the list such that the comparison changes, then the ordering of the list will not be maintained. Ideally, only immutable objects are placed in the list.

Author

rossetti

Parameters

the type held in the list

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
val size: Int

Functions

Link copied to clipboard
fun add(element: T): Boolean

The elements are added and the list is changed to maintain the order

Link copied to clipboard
fun addAll(elements: Collection<T>)

The elements are added and the ordering implied by the elements is maintained.

Link copied to clipboard
fun clear()

Removes all elements from the list

Link copied to clipboard
fun contains(element: T): Boolean
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
operator fun iterator(): MutableIterator<T>
Link copied to clipboard
fun remove(element: T): Boolean
fun remove(elementIndex: Int): T

The list order is maintained.

Link copied to clipboard
fun removeFirst(): T?

The list order is maintained.