|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface Traversable<E>
Traversable is the root of the collection hierarchy.
Traversable allows collections to be defined by a forEach(Function) method and without an
iterator. forEach(Function) can be a lot simpler to implement for tree-like structure and also offers
a more direct method of traversal for such structures.
| Method Summary | ||
|---|---|---|
|
forEach(Function<E,U> f)
All collection methods can be built upon this forEach definition. |
|
boolean |
isEmpty()
Returns true if this collection is empty. |
|
String |
makeString(String separator)
Returns this collection converted to a string by joining elements together with the specified separator. |
|
String |
makeString(String separator,
String prefix,
String postfix,
int limit,
String truncated)
Returns this collection converted to a string. |
|
int |
size()
Returns the size of the collection. |
|
|
to(Builder<E,R> builder)
Converts this collection to another collection using a builder. |
|
Object[] |
toArray()
Converts this collection to an array of objects. |
|
E[] |
toArray(E[] array)
Converts this collection to an array of objects of the correct type. |
|
IndexedList<E> |
toIndexedList()
Converts this collection to an indexed list. |
|
Set<E> |
toSet()
Converts this collection to a set. |
|
SortedSet<E> |
toSortedSet(Comparator<? super E> comparator)
Converts this collection to a sorted set. |
|
| Method Detail |
|---|
<U> void forEach(@NotNull
Function<E,U> f)
forEach definition.
int size()
Warning: infinite collections are possible, as are collections that require traversal to calculate the size.
boolean isEmpty()
@NotNull
String makeString(@NotNull
String separator)
separator.
@NotNull
String makeString(@NotNull
String separator,
@NotNull
String prefix,
@NotNull
String postfix,
int limit,
@NotNull
String truncated)
separator - Specifies the joining characterprefix - Specifies a prefix to the stringpostfix - Species a postfix to the stringlimit - Specifies the maximum number of elements to join. If the limit is exceeded, additional elements are ignored.truncated - If the limit is reached, the truncated value will be appended to indicate the limit was reached.
@NotNull
<R extends Traversable<E>> R to(@NotNull
Builder<E,R> builder)
@NotNull Set<E> toSet()
@NotNull SortedSet<E> toSortedSet(Comparator<? super E> comparator)
@NotNull IndexedList<E> toIndexedList()
@NotNull Object[] toArray()
@NotNull E[] toArray(E[] array)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||