Class AbstractTraversable<E>
- java.lang.Object
-
- com.github.andrewoma.dexx.collection.internal.base.AbstractTraversable<E>
-
- All Implemented Interfaces:
Traversable<E>
- Direct Known Subclasses:
AbstractIterable
public abstract class AbstractTraversable<E> extends java.lang.Object implements Traversable<E>
-
-
Constructor Summary
Constructors Constructor Description AbstractTraversable()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
isEmpty()
Returns true if this collection is empty.@NotNull java.lang.String
makeString(@NotNull java.lang.String separator)
Returns this collection converted to a string by joining elements together with the specifiedseparator
.@NotNull java.lang.String
makeString(@NotNull java.lang.String separator, @NotNull java.lang.String prefix, @NotNull java.lang.String postfix, int limit, @NotNull java.lang.String truncated)
Returns this collection converted to a string.int
size()
Returns the size of the collection.<R extends Traversable<E>>
Rto(@NotNull Builder<E,R> builder)
Converts this collection to another collection using a builder.@NotNull java.lang.Object[]
toArray()
Converts this collection to an array of objects.@NotNull E[]
toArray(E[] array)
Converts this collection to an array of objects of the correct type.@NotNull IndexedList<E>
toIndexedList()
Converts this collection to an indexed list.@NotNull Set<E>
toSet()
Converts this collection to a set.@NotNull SortedSet<E>
toSortedSet(java.util.Comparator<? super E> comparator)
Converts this collection to a sorted set.java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface com.github.andrewoma.dexx.collection.Traversable
forEach
-
-
-
-
Method Detail
-
size
public int size()
Description copied from interface:Traversable
Returns the size of the collection.Warning: infinite collections are possible, as are collections that require traversal to calculate the size.
- Specified by:
size
in interfaceTraversable<E>
-
makeString
@NotNull public @NotNull java.lang.String makeString(@NotNull @NotNull java.lang.String separator)
Description copied from interface:Traversable
Returns this collection converted to a string by joining elements together with the specifiedseparator
.- Specified by:
makeString
in interfaceTraversable<E>
-
makeString
@NotNull public @NotNull java.lang.String makeString(@NotNull @NotNull java.lang.String separator, @NotNull @NotNull java.lang.String prefix, @NotNull @NotNull java.lang.String postfix, int limit, @NotNull @NotNull java.lang.String truncated)
Description copied from interface:Traversable
Returns this collection converted to a string.- Specified by:
makeString
in interfaceTraversable<E>
- Parameters:
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, thetruncated
value will be appended to indicate the limit was reached.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
to
@NotNull public <R extends Traversable<E>> R to(@NotNull @NotNull Builder<E,R> builder)
Description copied from interface:Traversable
Converts this collection to another collection using a builder.- Specified by:
to
in interfaceTraversable<E>
-
toSet
@NotNull public @NotNull Set<E> toSet()
Description copied from interface:Traversable
Converts this collection to a set.- Specified by:
toSet
in interfaceTraversable<E>
-
toSortedSet
@NotNull public @NotNull SortedSet<E> toSortedSet(java.util.Comparator<? super E> comparator)
Description copied from interface:Traversable
Converts this collection to a sorted set.- Specified by:
toSortedSet
in interfaceTraversable<E>
-
toIndexedList
@NotNull public @NotNull IndexedList<E> toIndexedList()
Description copied from interface:Traversable
Converts this collection to an indexed list.- Specified by:
toIndexedList
in interfaceTraversable<E>
-
isEmpty
public boolean isEmpty()
Description copied from interface:Traversable
Returns true if this collection is empty.- Specified by:
isEmpty
in interfaceTraversable<E>
-
toArray
@NotNull public @NotNull java.lang.Object[] toArray()
Description copied from interface:Traversable
Converts this collection to an array of objects.- Specified by:
toArray
in interfaceTraversable<E>
-
toArray
@NotNull public @NotNull E[] toArray(E[] array)
Description copied from interface:Traversable
Converts this collection to an array of objects of the correct type.- Specified by:
toArray
in interfaceTraversable<E>
-
-