mutexkid
03/20/2018, 6:50 PMAndreas Sinz
03/20/2018, 8:40 PMList
. without any elements, you get an immutable EmptyList
, with a single element you get java.util.Collections.singletonList
and with multiple elements you get an ordinary ArrayList
Andreas Sinz
03/20/2018, 8:41 PMList
that is backed by a MutableList
and thus can be casted into ArrayList
and mutatedmutexkid
03/20/2018, 8:49 PMkarelpeeters
03/20/2018, 10:29 PMkarelpeeters
03/20/2018, 10:31 PMlistOf(1,2,3)
is a java.util.Arrays.ArrayList
which has a fixed size but is mutable.karelpeeters
03/20/2018, 10:32 PMmutexkid
03/21/2018, 2:11 AMAndreas Sinz
03/21/2018, 8:37 AMList
, no one guarantees that it stays this way for eternitykarelpeeters
03/21/2018, 9:29 AMmutexkid
03/21/2018, 1:51 PMkarelpeeters
03/21/2018, 1:52 PMlistOf
should be considered immutable.mutexkid
03/21/2018, 1:55 PMmutexkid
03/21/2018, 1:58 PMkarelpeeters
03/21/2018, 2:14 PMlistOf(*arr)
calls Arrays.toList
but the spread operator messes that up, see my recent question in #C0922A726. So I agree, the wording should be consistent.