Immutable Arrays
Breaking Changes:
- Extracted the
asList
method to an extension function and replaced the previous implementation, which delegated to
theasList
function on the backing array, with a custom list implementation that's guaranteed to always be
immutable. This was necessary because the Kotlin standard libraryArray<T>.asList
extension function doesn't
guarantee immutability via the wrapper list that it returns. - Renamed the
specializations
package tomultiplicativeSpecializations
to better reflect its contents. These
specializations are generated by multiplying all combinations of base types and using the most efficient resulting
type for each combination. There are hundreds of regular non-multiplicative specializations so this updated name stops
implying that these are the only specializations that exist.
New Features:
- Add
Collection.removeAll(immutableArray)
extension function - Add
Collection.containsAll(immutableArray)
extension function - Add
toHashSet
extension function - Add
toMutableSet
extension function - Add
toSet
extension function - Add
flatMapIndexed
specializations for flattening immutable arrays - Add
flatMap
specializations for flattening immutable arrays - Add
requireNoNulls
extension function - Add
indexOfLast(predicate)
method - Add
indexOfFirst(predicate)
method - Add
joinToString
method - Add
lastIndexOf(element)
extension function - Add
addAll(sequence)
to the immutable array builders - Add
indexOf(element)
extension function - Add
contains
operator
Performance Improvements:
- When converting iterables or sequences to immutable arrays, use immutable array builders instead of accumulating the
values in a temporary list as that's much more efficient.