Is there any specific reason why NonEmptySet and N...
# arrow-contributors
p
Is there any specific reason why NonEmptySet and NonEmptyList have a custom toString representation rather than delegating to the underlying collection (and most likely using the standard
AbstractCollection.toString()
)?
a
my thought there was that if you don't have something that tells you that you are using a NonEmptySomething, you may be a bit lost when debugging and logging. Maybe the default implementation of
toString
is ok in many cases, but it you wrap some custom collection implementation, it may get a bit confusing
p
Makes sense - colleague just had a test fail when switching from listOf to nonEmptyListOf - then again, the test shouldn't have been depending on toString 🤣