1Attean::ListIterator(3)User Contributed Perl DocumentatioAnttean::ListIterator(3)
2
3
4
6 Attean::ListIterator - Iterator implementation backed by a list/array
7 of values
8
10 This document describes Attean::ListIterator version 0.022
11
13 use v5.14;
14 use Attean;
15 my @values = map { Attean::Literal->new($_) } (1,2,3);
16 my $iter = Attean::ListIterator->new(
17 values => \@values,
18 item_type => 'Attean::API::Term',
19 );
20
21 say $iter->next->value; # 1
22 say $iter->next->value; # 2
23 say $iter->next->value; # 3
24
26 The Attean::ListIterator class represents a typed iterator. It
27 conforms to the Attean::API::RepeatableIterator role.
28
29 The Attean::ListIterator constructor requires two named arguments:
30
31 values
32 An array reference containing the items to iterate over.
33
34 item_type
35 A string representing the type of the items that will be returned
36 from the iterator.
37
39 "reset"
40 Resets the iterator's internal state so that iteration begins again
41 at the beginning of the values array.
42
43 "next"
44 Returns the iterator's next item, or undef upon reaching the end of
45 iteration.
46
47 "size"
48 Returns the number of elements still remaining in the iterator
49 until it is fully consumed or until "reset" is called.
50
52 Please report any bugs or feature requests to through the GitHub web
53 interface at <https://github.com/kasei/attean/issues>.
54
57 Gregory Todd Williams "<gwilliams@cpan.org>"
58
60 Copyright (c) 2014--2019 Gregory Todd Williams. This program is free
61 software; you can redistribute it and/or modify it under the same terms
62 as Perl itself.
63
64
65
66perl v5.28.1 2019-03-21 Attean::ListIterator(3)