Let's say I have
val asd = mutableListOf("lulu","bubu","gugu","bubu")
If I use asd.remove("bubu")
, it only removes the first bubu.
How to remove all bubu in asd without a loop?
You can use removeAll function that takes Collection as input which is array-List of string in this case. It will remove all occurences of all elements present in the parameter.
asd.removeAll(mutableListOf("bubu"))
Use this code and it should work now.