make | Creates and returns a new instance of self containing the elements passed in as vararg params. |
addAll | Calls collection:add(e) for each e in iter(iterable). |
contains | Returns true if element exists in collection. |
containsAll | Returns true iff collection:contains(e) for e in iter(iterable). |
containsAny | Returns true if for collection:contains(e) for some e in iter(iterable). |
collections.make(self, ...)If #args is 1, the argument is assumed to be iterable and its elements are added to the Collection.
Example, assuming Collection is a sequence type:
> print( Collection:make(1,2,3,4) ) [1, 2, 3, 4] > print( Collection:make(iter.count(4) ) [1, 2, 3, 4] > v = Collection:make(1,2,3,4); print( Collection:make(v) ) [1, 2, 3, 4]
This method is used as the make method for LinkedList, SkipVector, HashSet, SkipSet, QueueVector, and PairingHeap. It assumes that self has new() and addAll() methods.
collections.addAll(collection, iterable)
collections.contains(collection, element)This involves iterating through the entire collection and takes expected linear time.
collections.containsAll(collection, elements)
collections.containsAny(collection, iterable)