Collection
Latest Update | Stable Release | Release Candidate | Beta Release | Alpha Release |
---|---|---|---|---|
December 1, 2021 | 1.2.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:
Groovy
dependencies { def collection_version = "1.2.0" // Java language implementation implementation "androidx.collection:collection:$collection_version" // Kotlin implementation "androidx.collection:collection-ktx:$collection_version" }
Kotlin
dependencies { val collection_version = "1.2.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.
Feedback
Your feedback helps make Jetpack better. Let us know if you discover new issues or have ideas for improving this library. Please take a look at the existing issues in this library before you create a new one. You can add your vote to an existing issue by clicking the star button.
See the Issue Tracker documentation for more information.
Version 1.2.0
Version 1.2.0
December 1, 2021
androidx.collection:collection:1.2.0
and androidx.collection:collection-ktx:1.2.0
are released. Version 1.2.0 contains these commits.
Important changes since 1.1.0
- Add an array constructor to
ArraySet
. (Id7f19) - Make
entrySet()
API-compliant by implementingentrySet().toArray()
,remove()
,removeAll()
, andretainAll()
, and removing implementation ofentrySet().addAll()
(I5d505)
Version 1.2.0-rc01
November 17, 2021
androidx.collection:collection:1.2.0-rc01
and androidx.collection:collection-ktx:1.2.0-rc01
are released. Version 1.2.0-rc01 contains these commits.
API Changes
- No changes from previous beta.
Version 1.2.0-beta01
October 13, 2021
androidx.collection:collection:1.2.0-beta01
and androidx.collection:collection-ktx:1.2.0-beta01
are released. Version 1.2.0-beta01 contains these commits.
Bug Fixes
- Make
entrySet()
API-compliant by implementingentrySet().toArray()
,remove()
,removeAll()
, andretainAll()
, and removing implementation ofentrySet().addAll()
(I5d505)
Version 1.2.0-alpha01
December 16, 2020
androidx.collection:collection:1.2.0-alpha01
and androidx.collection:collection-ktx:1.2.0-alpha01
are released. Version 1.2.0-alpha01 contains these commits.
API Changes
- Add an array constructor to
ArraySet
. (Id7f19)
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
andisNotEmpty
functions in 'collection-ktx' artifact. (aosp/866529)
API changes
- Add
putIfAbsent
toLongSparseArray
,SimpleArrayMap
, andSparseArrayCompat
(aosp/772608) - Add
getOrDefault
toSimpleArrayMap
(aosp/772607) - Add two-argument
remove
toLongSparseArray
,SimpleArrayMap
, andSparseArrayCompat
. Deprecate corresponding KTX extensions for this functionality. (aosp/772482) - Add two-argument
replace
toLongSparseArray
,SimpleArrayMap
, andSparseArrayCompat
(aosp/772483) - Add three-argument
replace
toLongSparseArray
,SimpleArrayMap
, andSparseArrayCompat
(aosp/772484) - Deprecate redundant
delete
methods. Theremove
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 onSimpleArrayMap.class
instead ofArrayMap.class
. This ensures that if you are only usingSimpleArrayMap
,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
andisNotEmpty
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 onSimpleArrayMap.class
instead ofArrayMap.class
. This ensures that if you are only usingSimpleArrayMap
,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. Theremove
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
toLongSparseArray
,SimpleArrayMap
, andSparseArrayCompat
(aosp/772608) - Add
getOrDefault
toSimpleArrayMap
(aosp/772607) - Add two-argument
remove
toLongSparseArray
,SimpleArrayMap
, andSparseArrayCompat
. Deprecate corresponding KTX extensions for this functionality. (aosp/772482) - Add two-argument
replace
toLongSparseArray
,SimpleArrayMap
, andSparseArrayCompat
(aosp/772483) - Add three-argument
replace
toLongSparseArray
,SimpleArrayMap
, andSparseArrayCompat
(aosp/772484)