Class Overview
Performs a depth-first iteration given a starting set of comments
. For example, consider the
following comments:
C1
C1-R1
C1-R2
C2
C2-R1
C2-R1-R1
C2-R2
C2-R2-R1
C2-R2-R1-R1
C2-R3
C3
new CommentChain(ImmutableList.of(c1, c2, c3))
would traverse the comments in the same order as reading
that tree from the top to the bottom:
C1 -> C1-R1 -> C1-R2 -> C2 -> C2-R1 -> C2-R1-R1 -> C2-R2 -> C2-R2-R1 -> C2-R2-R1-R1 -> C2-R3 -> C3
Notice that C2-R1-R1, the first reply to the first reply of the second comment, is traversed before C2-R2, the
second reply to the second comment.
Note: This class supports any subtype C
of Comment
, under the assumption that all
replies
are consistently instances of C
. Violating that assumption will
result in ClassCastException
s when iterating through the chain.
Summary
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
|
boolean
|
equals(Object arg0)
|
void
|
finalize()
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
|
From interface
java.lang.Iterable
void
|
forEach(Consumer<? super T> arg0)
|
Iterator<T>
|
iterator()
|
Spliterator<T>
|
spliterator()
|
|
Public Constructors
public
CommentChain
(Iterable<C> rootComments)
Parameters
rootComments
| list of comment thread roots to expand
|
Public Methods
@Nonnull
public
Stream<C>
stream
()