How do you replace an element by index with an immutable List.
E.g.
val list = 1 :: 2 ::3 :: 4 :: List() list.replace(2, 5)
If you do a lot of such replacements, it is better to use a muttable class or Array.