|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.jga.algorithms.Append
public class Append
Algorithms that iterate over variable-length sets of inputs, ie, arrays, collections, or iterations, returning the combined contents of all inputs. For the common case, iterating over the combined contents of two inputs, the Merge class provides a type-safe wrapper around these algorithms. These algorithms are more flexible than the append forms of Merge, at the cost of being less type-safe.
NOTE: Use of these algorithms will result in type-safety warnings from the compiler: specifically "A generic array of ... is created for a varargs parameter". This is pretty much unavoidable given the mismatch in java between generics and arrays and given that variable length argument lists are converted to arrays by the compiler.
NOTE: Unlike most other classes in this package, Append does not support the form that puts the result of the algorithm into a collection passed as the last argument. The CollectionUtils class contains an append method that handles one input, and the Merge class contains an append method that handles two inputs. A varargs form of append to a given collection would be ambiguous in this class if it had the same name, and it would be ambiguous with the append in either CollectionUtils or Merge (or both) if all were statically imported. If you need to append three or more inputs to a given collection, the workaround is to call the appropriate method in this class to reduce the inputs to one, then use Collection.addAll (or CollectionUtils.append).
Copyright © 2008 David A. Hall
Nested Class Summary | |
---|---|
static class |
Append.AppendIterable<T>
Produces iterators that return the contents of a two-dimensional data structure |
static class |
Append.AppendIterator<T>
Iterator that returns the contents of a two-dimensional datastructure. |
Constructor Summary | |
---|---|
Append()
|
Method Summary | ||
---|---|---|
static
|
append()
Returns an empty iterable. |
|
static
|
append(java.lang.Iterable<? extends T>... inputs)
Returns an Iterable that 'contains' all of the elements of the input(s) |
|
static
|
append(java.util.Iterator<? extends T>... input)
Returns an Iterator that will return elements from all of the iterators |
|
static
|
append(T[]... ts)
Returns all elements of each array |
|
static
|
append(T[] ts)
Returns all elements of each array |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Append()
Method Detail |
---|
public static <T> java.lang.Iterable<? extends T> append()
public static <T> java.lang.Iterable<T> append(T[] ts)
public static <T> java.lang.Iterable<T> append(T[]... ts)
public static <T> java.lang.Iterable<? extends T> append(java.lang.Iterable<? extends T>... inputs)
public static <T> java.util.Iterator<? extends T> append(java.util.Iterator<? extends T>... input)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |