Hi guys, given a mutableSet, I’d like to remove al...
# getting-started
a
Hi guys, given a mutableSet, I’d like to remove all the items from a collection, and then just get X items from it. For example
Copy code
myMutableSet.removeAll(collection)
myMutableSet.take(x)
now I’d like not to use take since the set can contain millions of items and I’d like not to copy all in a new set..any suggestions? There is no constraints on the “which” X items to take..random is fine
alternatively, I’ll be happy to move the set into a list, as long as the items won’t be copied..
u
The items themselves will not be copied, only their references, so if that satisfies your constraints, then the code above is fine