public final class RecurrenceRuleIterator
extends java.lang.Object
Note: Some rules may recur forever, so be sure to add some limitation to your code that stops iterating after a certain number of instances or at a certain date.
| Modifier and Type | Method and Description |
|---|---|
void |
fastForward(org.dmfs.rfc5545.DateTime until)
Skip all instances up to a specific date.
|
void |
fastForward(long until)
Skip all instances up to a specific date.
|
boolean |
hasNext() |
org.dmfs.rfc5545.DateTime |
nextDateTime()
Get the next instance.
|
long |
nextMillis()
Get the next instance.
|
org.dmfs.rfc5545.DateTime |
peekDateTime()
Peek at the next instance to be returned by
nextDateTime() without actually iterating it. |
long |
peekMillis()
Peek at the next instance to be returned by
nextMillis() without actually iterating it. |
void |
skip(int skip)
Skip the given number of instances.
|
void |
skipAllButLast()
Skips all instances except for the last one.
|
public long nextMillis()
public org.dmfs.rfc5545.DateTime nextDateTime()
DateTime object for the next instance.public boolean hasNext()
public long peekMillis()
nextMillis() without actually iterating it. Calling this method (even multiple times) won't affect
the instances returned by nextMillis().null if there are no more instances.public org.dmfs.rfc5545.DateTime peekDateTime()
nextDateTime() without actually iterating it. Calling this method (even multiple times) won't affect
the instances returned by nextDateTime().null if there are no more instances.public void skip(int skip)
Note: After calling this method you should call hasNext() before you continue because
there might be less than skip instances left when you call this.
skip - The number of instances to skip.public void fastForward(long until)
Note: After calling this method you should call hasNext() before you continue
because there might no more instances left if there is an UNTIL or COUNT part in the rule.
until - The time stamp of earliest date to be returned by the next call to nextMillis() or nextDateTime().public void fastForward(org.dmfs.rfc5545.DateTime until)
Note: After calling this method you should call hasNext() before you continue
because there might no more instances left if there is an UNTIL or COUNT part in the rule.
until - The earliest date to be returned by the next call to nextMillis() or nextDateTime().public void skipAllButLast()
hasNext() before calling nextMillis() or nextDateTime() after you
called this.
Note: At present this will loop infinitely when called on an infinite rule. So better check RecurrenceRule.isInfinite() first.