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?
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?
Copyright © 2021 Jogjafile Inc.
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.
Use this code and it should work now.