Appendices 303
Add(T)
Creates a bag that is the same as this bag except that the multiplicity of the value
given as the argument is one larger.
CountItem(T)
Returns the number of times the value given as the argument appears in this bag.
This number is called the item??™s multiplicity.
Difference(Bag
)
Creates a bag where the multiplicity of each element is the difference of the
multiplicities in the current bag and the bag s given as the argument; that is, it
returns a bag where all the elements of s have been removed from this bag. This
is the same as the C# infix operator -.
Intersection(Bag)
Bag intersection. Returns the bag containing the elements that are shared by the
current bag and the bag given as the argument. The multiplicities of the result
are pairwise minimums of those of the arguments. This is the same as the C#
infix operator *.
Remove(T)
Creates a bag with the same elements as the current bag, except that the multiplicity
of the element x given as the argument is decremented by one. This
operation returns the current bag if the multiplicity of x is zero.
RemoveAll(T)
Creates a bag with the same elements as this bag, except that all occurrences of
the element given as the argument are omitted.
Union(Bag)
Creates a bag where the multiplicities of each element are the sum of the multiplicities
of the elements of the current bag and the bag given as the argument.
Pages:
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392