virtual class collection#( type T = int )
virtual Defines the core functionality of a collection.
| T | optional The type of collected data. The default is int. |
| collection | virtual Defines the core functionality of a collection. |
| Types | |
| da_type | The shorthand of the dynamic array of type T. |
| Properties | |
| cmp | protected A comparator to compare the elements of type T. |
| fmtr | protected An object that provides a function to convert the element of type T to a string. |
| Functions | |
| add | virtual Adds the given element. |
| add_all | virtual Adds all of the elements in the given collection to this collection. |
| clear | virtual Removes all of the elements from this collection. |
| contains | virtual Returns 1 if this collection contains the specified element. |
| contains_all | virtual Returns 1 if this collection contains all of the elements in the specified collection. |
| is_empty | virtual Returns 1 if this collection contains no elements. |
| get_iterator | pure virtual Returns an iterator over the elements contained in this collection. |
| remove | virtual Removes the specified element from this collection. |
| remove_all | virtual Removes the elements in the given collection from this collection. |
| retain_all | virtual Retains only the elements in this collection that are contained in the specified collection. |
| size | virtual Returns the number of elements in this collection. |
| to_dynamic_array | virtual Returns a new dynamic array that contains the elements in this collection. |
virtual function bit add_all( collection#( T ) c )
virtual Adds all of the elements in the given collection to this collection.
| c | A collection containing elements to be added to this collection. |
If this collection changed as a result of the call, 1 is returned. Otherwise, 0 is returned.
virtual function bit contains_all( collection#( T ) c )
virtual Returns 1 if this collection contains all of the elements in the specified collection.
| c | A collection to be checked. |
If this collection contains all of the elements in the specified collection, returns 1. Otherwise, returns 0.
virtual function bit remove_all( collection#( T ) c )
virtual Removes the elements in the given collection from this collection.
| c | A collection containing elements to be removed from this collection. |
If this collection changed as a result of the call, 1 is returned. Otherwise, 0 is returned.
virtual function bit retain_all( collection#( T ) c )
virtual Retains only the elements in this collection that are contained in the specified collection.
| c | A collection containing elements to be retained in this collection. |
If this collection changed as a result of the call, 1 is returned. Otherwise, 0 is returned.
virtual Defines the core functionality of a collection.
virtual class collection#( type T = int )
The shorthand of the dynamic array of type T.
typedef T da_type[]
protected A comparator to compare the elements of type T.
protected comparator#( T ) cmp
protected An object that provides a function to convert the element of type T to a string.
protected formatter#( T ) fmtr
virtual Adds the given element.
virtual function bit add( T e )
virtual Adds all of the elements in the given collection to this collection.
virtual function bit add_all( collection#( T ) c )
virtual Removes all of the elements from this collection.
virtual function void clear()
virtual Returns 1 if this collection contains the specified element.
virtual function bit contains( T e )
virtual Returns 1 if this collection contains all of the elements in the specified collection.
virtual function bit contains_all( collection#( T ) c )
virtual Returns 1 if this collection contains no elements.
virtual function bit is_empty()
pure virtual Returns an iterator over the elements contained in this collection.
pure virtual function iterator#( T ) get_iterator()
virtual Removes the specified element from this collection.
virtual function bit remove( T e )
virtual Removes the elements in the given collection from this collection.
virtual function bit remove_all( collection#( T ) c )
virtual Retains only the elements in this collection that are contained in the specified collection.
virtual function bit retain_all( collection#( T ) c )
virtual Returns the number of elements in this collection.
virtual function int size()
virtual Returns a new dynamic array that contains the elements in this collection.
virtual function da_type to_dynamic_array()