Skip to content

Releases: daniel-rusu/pods4k

0.7.0

17 Mar 06:04

Choose a tag to compare

Immutable Arrays

New Features:

  • Add shuffled() & shuffled(random) methods
  • Add toMutableArray() extension functions
  • Add toTypedMutableArray() extension functions
  • Add referencesSameArrayAs(immutableArray) method since referential equality isn't allowed for inline classes
  • Add copyFrom(regularArray, startIndex, size) companion factory function
  • Add randomOrNull() & randomOrNull(Random) methods
  • Add random() & random(Random) methods

Performance Improvements:

  • Update filter, filterIndexed, & filterNot to switch from accumulating elements in a builder to capturing
    accepted elements as single bits in an IntArray and use bitwise operations to avoid branching.
  • Update distinct() to use filter with a HashSet instead of calling toSet().toImmutableArray() to avoid using
    the more expensive LinkedHashSet while still maintaining original ordering. This also returns the same instance when
    all elements are already distinct.
  • Update immutableArrayOf(...) to avoid creating a temporary builder by using the copyFrom factory function
  • Update regularArray.toImmutableArray() to avoid creating a temporary builder by using the copyFrom factory
    function
  • Update plus to concatenate an element with an Immutable Array without using builders.
  • Update plus to concatenate 2 Immutable Arrays without using builders.
  • Update sortedWith on ImmutableArray<T> to copy the elements with arraycopy.
  • Update partition to use arraycopy to copy from the left side of the buffer.

0.6.0

09 Dec 23:55

Choose a tag to compare

Immutable Arrays

New Features:

  • Add unzip specialization
  • Add zip extension functions
  • Add zip with transform specializations
  • Add distinctBy method
  • Add distinct method
  • Add groupBy extension functions
  • Add associateWith extension functions
  • Add associateBy extension functions
  • Add associate extension functions
  • Add sumOf methods

0.5.0

07 Nov 03:08

Choose a tag to compare

Immutable Arrays

New Features:

  • Add dropLastWhile method
  • Add dropLast method
  • Add dropWhile method
  • Add drop method
  • Add takeLastWhile method
  • Add takeLast method
  • Add takeWhile method
  • Add take method
  • Add filterNotNull extension functions
  • Add filterIndexed method
  • Add filterNot method
  • Add flatten extension functions for immutable arrays, sequences, or iterables that contain nested immutable arrays
  • Add filter method
  • Add immutableArrayOfNotNull factory functions
  • Add ImmutableArray<Pair<K, V>>.toMap() extension function
  • Add MutableCollection.retainAll(immutableArray) extension function

Performance Improvements:

  • Update equals to first check the referential equality of the backing array and immediately return without checking
    the contents when they are the same backing array.
  • Make toList return the empty singleton when the size is 0, singleton-list when 1, and share the backing array when working
    with generic types.
  • Pre-allocate a perfectly sized buffer for partition by populating the buffer array from both ends.
  • Pre-allocate a perfectly sized backing array for flatMap & flatMapIndexed when operating on nested immutable
    arrays.

0.4.0

20 Aug 04:24

Choose a tag to compare

Immutable Arrays

Breaking Changes:

  • Extracted the asList method to an extension function and replaced the previous implementation, which delegated to
    the asList function on the backing array, with a custom list implementation that's guaranteed to always be
    immutable. This was necessary because the Kotlin standard library Array<T>.asList extension function doesn't
    guarantee immutability via the wrapper list that it returns.
  • Renamed the specializations package to multiplicativeSpecializations 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.

0.3.0

29 Jul 17:03

Choose a tag to compare

Breaking Changes:

  • Factory functions (like emptyImmutableArray, immutableArrayOf, buildImmutableArray, etc.) have been moved
    to ImmutableArrayFactory.kt to improve code organization

New Features:

  • Add flatMapIndexed specializations
  • Add flatMap specializations
  • Add partition method
  • Add asList method
  • Add MutableCollection.addAll(immutableArray) extension function
  • Add + operator overload for concatenating an immutable array with an additional value
  • Add + operator overload for concatenating two immutable arrays
  • Add count(predicate) method
  • Add none(predicate) method
  • Add any(predicate) method
  • Add all(predicate) method

Performance Improvements:

  • Reduce the memory usage of converting immutable arrays to lists by adding all the elements in a single step
  • Return EMPTY singleton when converting an empty regular array to an immutable array
  • Immutable array builders: Avoid copying the backing array when the final size matches the array size

0.2.0

17 Jul 01:58

Choose a tag to compare

Immutable Arrays

Breaking Changes:

  • Extension functions toImmutableIntArray, toImmutableFloatArray, etc. have been renamed
    to toImmutableArray so that the most efficient primitive variant is chosen by default.

New Features:

  • Add sortedByDescending method
  • Add sortedBy method
  • Add sortedDescending extension functions
  • Add sortedWith method
  • Add sorted extension functions
  • Add mapIndexedNotNull specializations
  • Add mapNotNull specializations
  • Add dynamic factory functions (eg. buildImmutableArray, buildImmutableBooleanArray etc.) for when the size
    isn't known in advance
  • Add builders for constructing immutable arrays when the size isn't known in advance
  • Add mapIndexed specializations
  • Add map specializations

Performance Improvements:

  • Optimized immutableArrayOf factory functions
  • Optimized the creation of immutable arrays from regular arrays

0.1.0

17 Jun 03:06

Choose a tag to compare

Immutable Arrays

  • New: Add declaration-site variance so that a variable of type ImmutableArray<Parent> can accept an
    ImmutableArray<Child> when Child extends Parent
  • New: Add equals & hashCode methods
  • New: Add Sequence toImmutableArray extension functions
  • New: Add ImmutablePrimitiveArray toTypedImmutableArray extension functions
  • New: Add generic ImmutableArray toImmutablePrimitiveArray extension functions
  • New: Add Iterable toImmutableArray extension functions
  • New: Add regular array toImmutableArray extension functions
  • New: Add emptyImmutableArray & emptyImmutablePrimitiveArray factory functions
  • New: Add immutableArrayOf factory functions
  • New: Add singleOrNull(predicate) method
  • New: Add singleOrNull method
  • New: Add single(predicate) method
  • New: Add lastOrNull(predicate) method
  • New: Add firstOrNull(predicate) method
  • New: Add last(predicate) method
  • New: Add first(predicate) method
  • New: Add withIndex method
  • New: Add asIterable method
  • New: Add getOrElse extension function
  • New: Add lastOrNull method
  • New: Add firstOrNull method
  • New: Add getOrNull method
  • New: Add toMutableList extension function
  • New: Add toList method
  • New: Add asSequence method
  • New: Add indices property
  • New: Add forEachIndexed method
  • New: Add forEach method
  • New: Add single method
  • New: Add last method
  • New: Add first method
  • New: Add componentN functions for destructuring
  • New: Add isEmpty & isNotEmpty methods
  • New: Add lastIndex property
  • New: Add toString method
  • New: Add iterator operator to allow regular for-loops
  • New: Add invoke factory function
  • New: Create ImmutableArray + 8 variants for each primitive type