Class Seq<T>
- java.lang.Object
-
- net.andreinc.mockneat.unit.seq.Seq<T>
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Seq<T>after(T after)Ifcycle(boolean)is not enabled, the @param after is the default value generated by the sequence.Seq<T>afterDoMock(MockUnit<T> after)Ifcycle(boolean)is not enabled, this method is used to generate values after the sequence is exhausted.Seq<T>cycle(boolean value)Enables cycling through the elements if the finite source of elements is exhausted.static <T> Seq<T>fromArray(T[] array)Returns aSeq<T>object that can be used to generate values by iterating through all the elements of an array in order.static Seq<java.lang.String>fromDict(DictType dictType)Returns a newSeq<String>object that can be used to generate values by iterating through all the lines associated with aDictTypestatic <T> Seq<T>fromIterable(java.lang.Iterable<T> iterable)Returns a newSeq<T>object that can be used to generate values by iterating trough the givenIterable<T>in order.static <T> Seq<T>seq(java.lang.Iterable<T> iterable)Returns a newSeq<T>object that can be used to generate values by iterating trough the givenIterable<T>in order.static Seq<?>seq(DictType dictType)Returns a newSeq<String>object that can be used to generate values by iterating through all the lines associated with aDictTypestatic <T> Seq<T>seq(T[] array)Returns aSeq<T>object that can be used to generate values by iterating through all the elements of an array in order.java.util.function.Supplier<T>supplier()This is the sole abstract method of the interface.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface net.andreinc.mockneat.abstraction.MockUnit
array, array, collection, collection, collection, collection, collection, collection, consume, consume, get, get, list, list, list, list, list, list, map, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapKeys, mapToDouble, mapToInt, mapToLocalDate, mapToLong, mapToString, mapToString, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, mapVals, serialize, set, set, set, set, set, set, stream, val, val, valStr, valStr
-
-
-
-
Method Detail
-
seq
public static Seq<?> seq(DictType dictType)
Returns a new
Seq<String>object that can be used to generate values by iterating through all the lines associated with aDictType- Parameters:
dictType- TheDictTypeto iterate over- Returns:
- A re-usable
Seq<String>. The class implementsMockUnitString
-
seq
public static <T> Seq<T> seq(java.lang.Iterable<T> iterable)
Returns a new
Seq<T>object that can be used to generate values by iterating trough the givenIterable<T>in order.- Type Parameters:
T- The type of both the resultingSeq<T>and theIterable<T>- Parameters:
iterable- TheIterable<T>values.- Returns:
- A re-usable
Seq<T>object. The class implementsMockUnit<T>
-
seq
public static <T> Seq<T> seq(T[] array)
Returns a
Seq<T>object that can be used to generate values by iterating through all the elements of an array in order.- Type Parameters:
T- The type of the array- Parameters:
array- The array to iterate over- Returns:
- A re-usable
Seq<T>. The class implementMockUnit<T>
-
fromDict
public static Seq<java.lang.String> fromDict(DictType dictType)
Returns a new
Seq<String>object that can be used to generate values by iterating through all the lines associated with aDictType- Parameters:
dictType- TheDictTypeto iterate over- Returns:
- A re-usable
Seq<String>. The class implementsMockUnitString
-
fromIterable
public static <T> Seq<T> fromIterable(java.lang.Iterable<T> iterable)
Returns a new
Seq<T>object that can be used to generate values by iterating trough the givenIterable<T>in order.- Type Parameters:
T- The type of both the resultingSeq<T>and theIterable<T>- Parameters:
iterable- TheIterable<T>values.- Returns:
- A re-usable
Seq<T>object. The class implementsMockUnit<T>
-
fromArray
public static <T> Seq<T> fromArray(T[] array)
Returns a
Seq<T>object that can be used to generate values by iterating through all the elements of an array in order.- Type Parameters:
T- The type of the array- Parameters:
array- The array to iterate over- Returns:
- A re-usable
Seq<T>. The class implementMockUnit<T>
-
cycle
public Seq<T> cycle(boolean value)
Enables cycling through the elements if the finite source of elements is exhausted.
For example if an array has 3 elements, and we create the sequence from it, after calling the
get()3 times, anullwill be retrieved.- Parameters:
value- By default it's false- Returns:
- The same
Seq<?>object.
-
after
public Seq<T> after(T after)
If
cycle(boolean)is not enabled, the @param after is the default value generated by the sequence.- Parameters:
after- The default value after Sequence it's generated.- Returns:
- The same
Seq<T>object.
-
afterDoMock
public Seq<T> afterDoMock(MockUnit<T> after)
If
cycle(boolean)is not enabled, this method is used to generate values after the sequence is exhausted.- Parameters:
after- TheMockUnit<T>to be used after the sequence is exhausted.- Returns:
- The same
Seq<T>object.
-
-