Add samples for reversed list views
#KT-20357
This commit is contained in:
committed by
Ilya Gorbunov
parent
2fc26ba08f
commit
1db0e5c23e
@@ -46,12 +46,14 @@ private fun List<*>.reversePositionIndex(index: Int) =
|
||||
/**
|
||||
* Returns a reversed read-only view of the original List.
|
||||
* All changes made in the original list will be reflected in the reversed one.
|
||||
* @sample samples.collections.ReversedViews.asReversedList
|
||||
*/
|
||||
public fun <T> List<T>.asReversed(): List<T> = ReversedListReadOnly(this)
|
||||
|
||||
/**
|
||||
* Returns a reversed mutable view of the original mutable List.
|
||||
* All changes made in the original list will be reflected in the reversed one and vice versa.
|
||||
* @sample samples.collections.ReversedViews.asReversedMutableList
|
||||
*/
|
||||
@kotlin.jvm.JvmName("asReversedMutable")
|
||||
public fun <T> MutableList<T>.asReversed(): MutableList<T> = ReversedList(this)
|
||||
|
||||
Reference in New Issue
Block a user