Collections::Set - Easy to use iterator with unique elements


Collections documentation  | view source Contained in the Collections distribution.

Index


NAME

Top

Collections::Set - Easy to use iterator with unique elements

VERSION

Top

Version 0.01

SYNOPSIS

Top

    use Collections::Set;

    my $col = Collections::Set->new;

    # Add new element
    $col->add('some string');
    $col->add('some string');

    # Size will return 1 (One unique element)
    print $col->size;

    # Remove element
    $col>remove('some string');

    # Size will return 0
    print $col->size;

INSTANCE METHODS

Top

add($element)

Add $element as part of receiver's elements, if the element already exists it does nothing

  $colection->add(1);

add_all($elements)

Add all $collection's element as part of receiver's elements, it adds elements that don't already exists in the collection

  $colection->add_all($another_collection);
  ... or ...
  $collection->add_all(1,2,3);
  ... or ...
  $colection->add_all([1,2,3]);

to_ordered()

Returns an Collections::Ordered with the same elements of this collection

   my $col = $collection->to_ordered;

AUTHOR

Top

Mariano Wahlmann, <dichoso at gmail.com>

BUGS

Top

Please report any bugs or feature requests to dichoso at gmail.com. I will be notified, and then you'll be notified of progress on your bug as I make changes.

COPYRIGHT & LICENSE

Top


Collections documentation  | view source Contained in the Collections distribution.