# ********** IteratorDemo.pl **********
use strict;

use IteratorCollection;
use Integer;
use Time::HR;

my $t1 = gethrtime();
my $collection = IteratorCollection->new();
my $i;
my $j;
for ($j=0; $j<5; $j++) { 
  for ($i=0; $i<500000; $i++) { 
    $collection->addItem(Integer->new($i));
  }
  my $iterator = $collection->createIterator;

  while ($iterator->hasNext) {
    my $item = $iterator->next;
    #print $item->intValue."\n";
  }
}
my $t2 = gethrtime();
print (int(($t2-$t1)/1000000))." ";
