Basics<T> extension

ads list methods that should have (mostly) been included in the stdlib from the beginning

on

Properties

firstOrNull → T?

Available on List<T>, provided by the Basics extension

no setter
lastOrNull → T?

Available on List<T>, provided by the Basics extension

no setter

Methods

at(int index) → T

Available on List<T>, provided by the Basics extension

pysublist(int firstIndex, int lastIndex) List<T>

Available on List<T>, provided by the Basics extension

provides python like list indexing which accepts negative values
rotate([int n = 1]) Iterable<T>

Available on List<T>, provided by the Basics extension

shift(T elem) → void

Available on List<T>, provided by the Basics extension

moves all elements of a list on index to the left and ads a new element to the end of a list
shiftn(T elem, int len) → void

Available on List<T>, provided by the Basics extension

adds the elem to the end of this if n is given the first element is popped, if the list is longer than n
takeRandom(int n) Iterable<T>

Available on List<T>, provided by the Basics extension