The Android Developer Challenge is back! Submit your idea before December 2.

Collection

Latest Update Current Stable Release Next Release Candidate Beta Release Alpha Release
June 5, 2019 1.1.0 - - -

Declaring dependencies

To add a dependency on Collection, you must add the Google Maven repository to your project. Read Google's Maven repository for more information.

Add the dependencies for the artifacts you need in the build.gradle file for your app or module:

dependencies {
    def collection_version = "1.1.0"

    // Java language implementation
    implementation "androidx.collection:collection:$collection_version"
    // Kotlin
    implementation "androidx.collection:collection-ktx:$collection_version"
}

For more information about dependencies, see Add Build Dependencies.

Version 1.1.0

Version 1.1.0

June 5, 2019

androidx.collection:collection:1.1.0 and androidx.collection:collection-ktx:1.1.0 are released. The commits included 1.1.0 can be found here.

Below is a summary of changes from 1.0.0 to 1.1.0:

New features

  • Use more efficient implementation for contains and isNotEmpty functions in 'collection-ktx' artifact. (aosp/866529)

API changes

  • Add putIfAbsent to LongSparseArray, SimpleArrayMap, and SparseArrayCompat (aosp/772608)
  • Add getOrDefault to SimpleArrayMap (aosp/772607)
  • Add two-argument remove to LongSparseArray, SimpleArrayMap, and SparseArrayCompat. Deprecate corresponding KTX extensions for this functionality. (aosp/772482)
  • Add two-argument replace to LongSparseArray, SimpleArrayMap, and SparseArrayCompat (aosp/772483)
  • Add three-argument replace to LongSparseArray, SimpleArrayMap, and SparseArrayCompat (aosp/772484)
  • Deprecate redundant delete methods. The remove method offers the same API and functionality and matches the API used by non-specialized Maps. (aosp/866053)

Bug fixes

  • Change SimpleArrayMap to synchronize its internal global cache of arrays on SimpleArrayMap.class instead of ArrayMap.class. This ensures that if you are only using SimpleArrayMap, ArrayMap can be removed by code shrinking tools. (aosp/934557)

Version 1.1.0-rc01

May 7, 2019

androidx.collection:collection:1.1.0-rc01 and androidx.collection:collection-ktx:1.1.0-rc01 are released. The commits included in this version can be found here.

New features

  • Use more efficient implementation for contains and isNotEmpty functions in 'collection-ktx' artifact. (aosp/866529)

Version 1.1.0-beta01

April 3, 2019

androidx.collection:collection:1.1.0-beta01 and androidx.collection:collection-ktx:1.1.0-beta01 are released. The commits included in this version can be found here.

API changes

  • The method mentioned in the alpha03 release notes as having its @RestrictTo value changed has been removed. It was unused by any AndroidX library (now or historically) and it did not offer any functionality that was missing from the public API.

Bug fixes

  • Change SimpleArrayMap to synchronize its internal global cache of arrays on SimpleArrayMap.class instead of ArrayMap.class. This ensures that if you are only using SimpleArrayMap, ArrayMap can be removed by code shrinking tools. (aosp/934557)

Version 1.1.0-alpha03

March 13, 2019

androidx.collection:collection:1.0.0-alpha03 and androidx.collection:collection-ktx:1.0.0-alpha03 are released. The full list of commits included in this version can be found here.

API changes

  • A method on ArraySet previously marked @RestrictTo(LIBRARY_GROUP) was changed to @RestrictTo(LIBRARY_GROUP_PREFIX). This is to support historical use by other AndroidX libraries which are now in different Maven group IDs. This method will either be made public or removed in 1.1.0-alpha04 because other AndroidX libraries should not get special APIs that other developers do not.

Version 1.1.0-alpha02

January 30, 2019

androidx.collection:collection 1.1.0-alpha02 and androidx.collection:collection-ktx 1.1.0-alpha02 are released.

API changes

  • Deprecate redundant delete methods. The remove methods offers the same API and functionality and matches the API used by non-specialized Maps. (aosp/866053)

Version 1.1.0-alpha01

December 3, 2018

API changes

  • Add putIfAbsent to LongSparseArray, SimpleArrayMap, and SparseArrayCompat (aosp/772608)
  • Add getOrDefault to SimpleArrayMap (aosp/772607)
  • Add two-argument remove to LongSparseArray, SimpleArrayMap, and SparseArrayCompat. Deprecate corresponding KTX extensions for this functionality. (aosp/772482)
  • Add two-argument replace to LongSparseArray, SimpleArrayMap, and SparseArrayCompat (aosp/772483)
  • Add three-argument replace to LongSparseArray, SimpleArrayMap, and SparseArrayCompat (aosp/772484)