考虑以下几点:列表(1)#contains()返回`FALSE`
scala> List(1).contains()
warning: there was one deprecation warning; re-run with -deprecation for details
res18: Boolean = false
为什么false
回报?
List#contains具有签名:
def contains[A1 >: A](elem: A1): Boolean
所以,据我所知,contains
参数必须是等于或高于A
的类型。
为什么这会返回false
?
'():Unit'是它从'contains()'中获得的参数。 –