Closed lukepighetti closed 2 years ago
The List
extension is also called build
; I think what you're referring to is that the Iterable
extension is toBuiltList
.
Map
doesn't interact in the same way with Iterable
, so there's no extension there for Map. We could add an extension on Iterable<MapEntry<K, V>>
called toBuiltMap
, I think that would be equivalent. But not sure how often people would find it. What do you think?
OK, I understand better the situation now. Thank you.
I agree with your assessment given the current state of the codebase. And I agree that Iterable
I believe that List.build()
/ Map.build()
mentally conflict with BuiltList.build((b)=> ...)
and BuiltMap.build((b)=> ...)
. I believe that this is confusing. I believe the API should only be:
Iterable.toBuiltList()
Iterable.toBuiltSet()
Map.toBuiltMap()
BuiltList.build((b)=>...)
BuiltSet.build((b)=>...)
BuiltMap.build((b)=>...)
And the following should be deprecated
List.build()
Set.build()
Map.build()
I understand your point of view-- but don't think it's worth changing at this point.
If you like you can add the renamed extension methods for use in your own code :)
Thanks.
List extension is
List.toBuiltList()
When trying to discover the Map equivalent, it's hard to find because it's
Map.build()
.This PR aliases
Map.toBuiltMap()
toMap.build()
and deprecates the latter.This will unify the naming convention with
List.toBuiltList()
and improve discoverability of the Map to BuiltMap converting extension