Nir
12/19/2021, 6:23 PMisEmpty
as an extension property with size == 0
seems fine...ephemient
12/19/2021, 6:39 PMIterable
interface, that would make sense as they're not necessarily sized, but since Collection
is always sized… I dunnoNir
12/19/2021, 6:40 PMJakub Gwóźdź
12/20/2021, 10:57 AMit.empty
is more readable than it.isEmpty()
, as “empty” is also a verb and when skimming code, might suggest clearing the collection.Nir
12/21/2021, 2:07 PMempty
vs isEmpty
have to do with property vs function?Jakub Gwóźdź
12/22/2021, 10:27 AMpublic class Foo {
int size;
public boolean isEmpty() { return size == 0;}
}
If I want to use it in Kotlin and I write Foo().isEmpty()
, kotlin complains with warning that I should use Foo().isEmpty
😮Nir
12/23/2021, 5:43 PM