Closed rich-j closed 5 years ago
Hi! Sorry for the long wait -- I'm back in the real world now! I've added isEmpty to AVLTree, IList, IMap, ISet and IVector and released as 0.8.6 from master + rebased into 0_9_0_wip_2. I'm hopeful that I'll be able to get rid of that long lived branch and release a proper 0.9.0 soon.
We would like to have a straight-forward way to evaluate collections for "empty". Today we use constructs such as
myIList.headOption.isNone()
andmyISet.all((_)=>false)
. It would be nice to use something likemyIList.isEmpty
andmyISet.isEmpty
.In https://github.com/spebbe/dartz/issues/17#issuecomment-513777240 you propose
myIList == nil()
- but that construct doesn't work well forISet
(a matching ISetorder
must be provided and is evaluated too).We use "ternary" constructs along with the new collection operators for "spread" and "if". An
isEmpty
would clean up Flutter code such asWe definitely would like this on
IList
andISet
. For consistency it would probably make sense on the other collections such asIMap
,IVector
, etc.Thanks.