Package

org.taffy.core.container

Object Hierarchy
What is it?

Container is an abstract class that provides operators that are pertinent to all Taffy containers.

Classes Inheriting from Container

Methods

hash

Returns the sum of the hash of each element in the container.

isEmpty?

Returns true if the container size is 0.

Example:

[] isEmpty?
==> true

[1] isEmpty?
==> false
contains?: block

Runs the given block against each container element. The block must take exactly one argument. If the block returns true then true is returned. False is returned if no block execution returns true.

Example:

a = [1, 2, 3]

a contains?: { <value> value < 2 }
==> true

a contains?: { <value> value > 100 }
==> false
find: block

Runs the given block against each container element. The block must take exactly one argument. If the block returns true, the element is returned.

Example:

a = [1, 2, 3]
a find: { <value> value == sqrt(4) }
==> 2