dartx icon indicating copy to clipboard operation
dartx copied to clipboard

equals extension for deep equality of iterables

Open machinescream opened this issue 4 years ago • 7 comments

Please add equals extensions based on ListEquality and so on...

machinescream avatar Jan 30 '20 11:01 machinescream

~It is not possible to create an extension named equals because every object already has a method with that name.~ There already exists the .contentEquals() extension for iterables (and lists).

simc avatar Jan 30 '20 11:01 simc

I like the idea but I'm unsure if we should use ListEquality or DeepCollectionEquality. Please describe your use case and we can see which API fits best.

Alternatively you could use collections which support equality by default: BuildList or KtList

passsy avatar Jan 30 '20 12:01 passsy

You probably mean == operator, I didn't see a equals in Iterable, List, etc. .contentEquals() is ok.

machinescream avatar Jan 30 '20 12:01 machinescream

You probably mean == operator

Yes, my bad. Is the contentEquals() method not suggested for auto-completion if you type "equals"?

simc avatar Jan 30 '20 12:01 simc

To be honest I am against about to use different collections. I prefer use core lib with extensions =)

machinescream avatar Jan 30 '20 13:01 machinescream

Does contentEquals() solve your problem or do you need more options / deep collection equality?

simc avatar Jan 30 '20 17:01 simc

Well, contentEquals solved my problem, but I think will be nice to have deep collection equality as well.

machinescream avatar Jan 30 '20 17:01 machinescream