It appears that using i -= i.head
does not perform the same function as i.remove(0)
on a ListBuffer. Is that right. If so why?
Scala: Can I use -= head to remove an item from a list?
273 views Asked by finsysvlogger At
1
It appears that using i -= i.head
does not perform the same function as i.remove(0)
on a ListBuffer. Is that right. If so why?
i -= i.head
returns the modifiedListBuffer
.i.remove(0)
returns the element removed from theListBuffer
.The resulting modified
ListBuffer
is the same in either case.