com.github.andrewoma.dexx.collection.internal.base
Class AbstractTraversable<E>

java.lang.Object
  extended by com.github.andrewoma.dexx.collection.internal.base.AbstractTraversable<E>
All Implemented Interfaces:
Traversable<E>
Direct Known Subclasses:
AbstractIterable

public abstract class AbstractTraversable<E>
extends Object
implements Traversable<E>


Constructor Summary
AbstractTraversable()
           
 
Method Summary
 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.
<R extends Traversable<E>>
R
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.
 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
 

Constructor Detail

AbstractTraversable

public AbstractTraversable()
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 interface Traversable<E>

makeString

@NotNull
public String makeString(@NotNull
                                 String separator)
Description copied from interface: Traversable
Returns this collection converted to a string by joining elements together with the specified separator.

Specified by:
makeString in interface Traversable<E>

makeString

@NotNull
public String makeString(@NotNull
                                 String separator,
                                 @NotNull
                                 String prefix,
                                 @NotNull
                                 String postfix,
                                 int limit,
                                 @NotNull
                                 String truncated)
Description copied from interface: Traversable
Returns this collection converted to a string.

Specified by:
makeString in interface Traversable<E>
Parameters:
separator - Specifies the joining character
prefix - Specifies a prefix to the string
postfix - Species a postfix to the string
limit - 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.

toString

public String toString()
Overrides:
toString in class Object

to

@NotNull
public <R extends Traversable<E>> R to(@NotNull
                                               Builder<E,R> builder)
Description copied from interface: Traversable
Converts this collection to another collection using a builder.

Specified by:
to in interface Traversable<E>

toSet

@NotNull
public Set<E> toSet()
Description copied from interface: Traversable
Converts this collection to a set.

Specified by:
toSet in interface Traversable<E>

toSortedSet

@NotNull
public SortedSet<E> toSortedSet(Comparator<? super E> comparator)
Description copied from interface: Traversable
Converts this collection to a sorted set.

Specified by:
toSortedSet in interface Traversable<E>

toIndexedList

@NotNull
public IndexedList<E> toIndexedList()
Description copied from interface: Traversable
Converts this collection to an indexed list.

Specified by:
toIndexedList in interface Traversable<E>

isEmpty

public boolean isEmpty()
Description copied from interface: Traversable
Returns true if this collection is empty.

Specified by:
isEmpty in interface Traversable<E>

toArray

@NotNull
public Object[] toArray()
Description copied from interface: Traversable
Converts this collection to an array of objects.

Specified by:
toArray in interface Traversable<E>

toArray

@NotNull
public 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 interface Traversable<E>


Copyright © 2014. All Rights Reserved.