I have these elements shuffled in a list
val list = (1,2,3,0, 0)
I need to split this list into two lists.
val list1 = (1)
val list2 = (2, 3, 0, 0)
The first list contains a single item that is not a 0
, the second list contains the rest of the items.
Fix below code, so list1 never contains 0
and list1 :: list2 == list
val list = (1, 2, 0, 3, 0).shuffle
val list1 = list(0)
val list2 = list drop 1
Somewhat similar to this: How should I remove the first occurrence of an object from a list in Scala?