Both exist, for example, here:
Map.empty[Int, Int]
Map(1 -> 41).empty
Set().empty
Set.empty
But here there are only class methods:
List.empty
List(1,2,3).empty
Array.empty
Array("a").empty
Is an emptyideal case for a class method (and therefore should not exclude an instance method empty)?
Or should instance method a be added emptyto classes that skip it?
Is there anything in terms of language that makes it difficult to use emptya class as a method (for example, type inference, higher class types, ...).
PS: It has been suggested that cards with default values would be more difficult to achieve without an instance method empty:
Map[Int, Int](1->2, 21->42).withDefault(_*2).empty
What do you think?
source