PreviousAssociation Up
Base Class Library


An instance of Bag is a collection which stores non-ordered elements. You can store duplicate elements in bags. Bags provide a more space efficient mechanism than arrays by taking account of objects with the same value. Bags are recommended when you expect to store many duplicate elements.

Elements can be objects or COBOL intrinsic data. Use the "ofReferences" method to create an instance for storing objects, and the "ofValues" method to create an instance for storing COBOL intrinsic data.

See method ofValues.

See method ofReferences.

Class-Control Entry

Include this entry in the Class-Control paragraph of any program using this class.

Bag is class "bag"



buttonClass Methods

Instance Methods

The list includes methods inherited from superclasses up to, but not including, Collection. For other inherited methods, click the button below:


add Using anelement
addwithOccurrences Using anelement lnkoccurs
copy Returning aNewBag
doWithOutCopy Using amessage
finalize Returning defaultreturn
includes Using anelement
Returning lnkbool
isIndexed Returning lnkbool
occurrencesOf Using anelement
Returning lnkoccurs
remove Using anelement
size Returning lnksize