Learn R Programming

container (version 1.0.5)

OrderedSet: OrderedSet Class

Description

The OrderedSet is a Set where all elements are always ordered.

Arguments

Super classes

container::Iterable -> container::Container -> container::Set -> OrderedSet

Methods

Inherited methods


Method new()

OrderedSet constructor

Usage

OrderedSet$new(...)

Arguments

...

initial elements put into the OrderedSet

Returns

returns the OrderedSet object


Method add()

Add element

Usage

OrderedSet$add(value, name = NULL)

Arguments

value

value of ANY type to be added to the OrderedSet.

name

character optional name attribute of the value.

Returns

the OrderedSet object.


Method clone()

The objects of this class are cloneable with this method.

Usage

OrderedSet$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Details

The order of elements is determined sequentially as follows:

  • element's length

  • whether it is an atomic element

  • the element's class(es)

  • by numeric value (if applicable)

  • it's representation when printed

  • the name of the element in the Set

See Also

Container, Set

Examples

Run this code
s1 = OrderedSet$new(2, 1)
s1

Run the code above in your browser using DataLab