choice

virtual class choice #(type T =  int)

virtual Provides functions to choose an item.

Parameter

Toptional The type of items.  The default is int.
Summary
choicevirtual Provides functions to choose an item.
Functions
minstatic Returns the smaller item.
maxstatic Returns the larger item.

Functions

min

static function T min(x,  
y,  
comparator#(T) cmp =  null)

static Returns the smaller item.

Arguments

xAn item of type T.
yAnother item of type T.
cmpoptional A strategy object used to compare the items.  If not specified or null, comparator #(T) is used.  The default is null.

Example

assert( choice#(int)::min( 1, 2 ) == 1 );

max

static function T max(x,  
y,  
comparator#(T) cmp =  null)

static Returns the larger item.

Arguments

xAn item of type T.
yAnother item of type T.
cmpoptional A strategy object used to compare the items.  If not specified or null, comparator #(T) is used.  The default is null.

Example

assert( choice#(int)::max( 1, 2 ) == 2 );
virtual class choice #(type T =  int)
virtual Provides functions to choose an item.
static function T min(x,  
y,  
comparator#(T) cmp =  null)
static Returns the smaller item.
static function T max(x,  
y,  
comparator#(T) cmp =  null)
static Returns the larger item.
class comparator#(type T =  int)
singleton Provides strategies to compare objects.