T - the element type of the Listpublic static interface C.List<T> extends List<T>, C.ReversibleSequence<T>
The osgl List interface is a mixture of List and osgl C.Sequence
| Modifier and Type | Interface and Description |
|---|---|
static interface |
C.List.Cursor<T>
A cursor points to an element of a
List. |
C.Featured.Factory| Modifier and Type | Method and Description |
|---|---|
C.List<T> |
accept(Lang.IndexedVisitor<Integer,? super T> indexedVisitor)
Loop through the list and for each element, call on the indexedVisitor function specified
|
C.List<T> |
accept(Lang.Visitor<? super T> visitor)
Iterate this
Traversable with a visitor function. |
C.List<T> |
acceptLeft(Lang.IndexedVisitor<Integer,? super T> indexedVisitor)
Loop through the list from
0 to size - 1. |
C.List<T> |
acceptLeft(Lang.Visitor<? super T> visitor)
Iterate through this sequence from head to tail with the visitor function specified
|
C.List<T> |
acceptRight(Lang.IndexedVisitor<Integer,? super T> indexedVisitor)
Loop through the list from
size() - 1 to 0. |
C.List<T> |
acceptRight(Lang.Visitor<? super T> visitor)
Iterate through this sequence from tail to head with the visitor function specified
|
boolean |
addAll(Iterable<? extends T> iterable)
Add all elements from an
Iterable into this list. |
C.List<T> |
append(C.List<T> list)
Returns a List contains all elements in this List followed by all elements in the specified List.
|
C.List<T> |
append(Collection<? extends T> iterable) |
C.List<T> |
append(T t)
Returns a sequence consists of all elements of this sequence followed by the element specified.
|
<R> C.List<R> |
collect(String path) |
C.List<T> |
copy()
Returns a mutable copy of this list
|
C.List<T> |
drop(int n)
Returns a
Sequence consisting of the elements from this Sequence except the first n if number n is positive and the Sequence contains more than n elements |
C.List<T> |
dropWhile(Lang.Function<? super T,Boolean> predicate)
Returns a
Sequence consisting of the elements from this sequence with leading elements dropped until the predicate returns true |
C.List<T> |
each(Lang.IndexedVisitor<Integer,? super T> indexedVisitor)
Alias of
#accept(Visitor) |
C.List<T> |
each(Lang.Visitor<? super T> visitor)
Alias of
C.Traversable.accept(Lang.Visitor) |
C.List<T> |
eager()
Returns this traversable and make sure
C.Feature.LAZY is unset |
C.List<T> |
filter(Lang.Function<? super T,Boolean> predicate)
Returns an new traversable that contains all elements in the current traversable except that does not pass the test of the filter function specified.
|
<R> C.List<R> |
flatMap(Lang.Function<? super T,? extends Iterable<? extends R>> mapper)
Returns a traversable consisting of the results of replacing each element of this stream with the contents of the iterable produced by applying the provided mapping function to each element.
|
C.List<T> |
forEach(Lang.IndexedVisitor<Integer,? super T> indexedVisitor)
Alias of
#accept(Visitor) |
C.List<T> |
forEach(Lang.Visitor<? super T> visitor)
Alias of
C.Traversable.accept(Lang.Visitor) |
C.List<T> |
head(int n)
Alias of
C.Sequence.take(int) |
C.List<T> |
insert(int index,
List<T> subList)
Insert a sub list at the position specified by
index. |
C.List<T> |
insert(int index,
T... ta)
Insert an array of elements at the position specified by
index. |
C.List<T> |
insert(int index,
T t)
Insert an element at the position specified by
index. |
C.List<T> |
lazy()
Returns this traversable and make sure
C.Feature.LAZY is set |
C.List.Cursor<T> |
locate(Lang.Function<T,Boolean> predicate)
Locate any one element in the list that matches the predicate.
|
C.List.Cursor<T> |
locateFirst(Lang.Function<T,Boolean> predicate)
Find the first element in this list that matches the predicate.
|
C.List.Cursor<T> |
locateLast(Lang.Function<T,Boolean> predicate)
Locate the first element in this list that matches the predicate.
|
<R> C.List<R> |
map(Lang.Function<? super T,? extends R> mapper)
Returns an new traversable with a mapper function specified.
|
C.List<T> |
parallel()
Returns this traversable and make sure
C.Feature.PARALLEL is set |
C.List<T> |
prepend(C.List<T> list) |
C.List<T> |
prepend(Collection<? extends T> collection) |
C.List<T> |
prepend(T t)
Returns a sequence consists of the element specified followed by all elements of this sequence.
|
C.List<T> |
readOnly()
Returns a view of this list that is readonly.
|
C.List<T> |
remove(Lang.Function<? super T,Boolean> predicate)
For mutable list, remove all element that matches the predicate specified from this List and return this list once done.
|
C.List<T> |
reverse()
Returns an new
Sequence that reverse this Sequence. |
C.List<T> |
sequential()
Returns this traversable and make sure
C.Feature.PARALLEL is unset |
C.List<T> |
snapshot()
Returns an immutable list contains all elements of the current list.
|
C.List<T> |
sorted()
Returns a sorted copy of this list.
|
C.List<T> |
sorted(Comparator<? super T> comparator)
Returns a sorted copy of this list.
|
Lang.T2<C.List<T>,C.List<T>> |
split(Lang.Function<? super T,Boolean> predicate)
Split this list into two list based on the predicate specified.
|
C.List<T> |
subList(int fromIndex,
int toIndex) |
C.List<T> |
tail()
Returns the rest part of the
Sequence except the first element |
C.List<T> |
tail(int n)
Returns a
Sequence consisting the last n elements from this Sequence if number n is positive and the Sequence contains more than n elements |
C.List<T> |
take(int n)
Returns a
Sequence consisting the first n elements from this Sequence if number n is positive and the Sequence contains more than n elements |
C.List<T> |
takeWhile(Lang.Function<? super T,Boolean> predicate)
Returns an new
Sequence that takes the head of this Sequence until the predicate evaluate to false: |
<K,V> C.Map<K,V> |
toMap(Lang.Function<? super T,? extends K> keyExtractor,
Lang.Function<? super T,? extends V> valExtractor)
Create a
Map from this list using a key extract function and a value extract function |
<V> C.Map<T,V> |
toMapByKey(Lang.Function<? super T,? extends V> valExtractor)
Create a
Map from this list using a value extract function. |
<K> C.Map<K,T> |
toMapByVal(Lang.Function<? super T,? extends K> keyExtractor)
Create a
Map from this list using a key extract function. |
C.List<T> |
unique()
Return a list that contains unique set of this list and keep the orders.
|
C.List<T> |
unique(Comparator<T> comp)
Return a list that contains unique set as per the comparator specified of this list and keep the orders.
|
C.List<T> |
without(Collection<? super T> col)
Returns a List contains all elements in this List and not in the
col collection specified |
C.List<T> |
without(T element)
Returns a list contains all elements in the list except the one specified
|
C.List<T> |
without(T element,
T... elements)
Returns a list contains all elements in the list except the ones specified
|
<T2> C.List<Lang.Binary<T,T2>> |
zip(List<T2> list)
Returns a list formed from this list and another iterable collection by combining corresponding elements in pairs.
|
<T2> C.List<Lang.Binary<T,T2>> |
zipAll(List<T2> list,
T def1,
T2 def2)
Returns a list formed from this list and another iterable collection by combining corresponding elements in pairs.
|
C.Sequence<Lang.Binary<T,Integer>> |
zipWithIndex()
Zip this sequence with its indices
|
add, add, addAll, addAll, clear, contains, containsAll, equals, get, hashCode, indexOf, isEmpty, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, replaceAll, retainAll, set, size, sort, spliterator, toArray, toArrayparallelStream, removeIf, streamappend, findLast, last, prepend, reduceRight, reduceRight, reverseIterator, zip, zipAllappend, append, append, append, asList, count, findFirst, first, head, prepend, prepend, prepend, prepend, reduce, reduce, reduceLeft, reduceLeft, zip, zipAllallMatch, anyMatch, findOne, isEmpty, noneMatch, sizefeatures, isC.List<T> parallel()
Returns this traversable and make sure C.Feature.PARALLEL is set
parallel in interface C.ReversibleSequence<T>parallel in interface C.Sequence<T>parallel in interface C.Traversable<T>C.List<T> sequential()
Returns this traversable and make sure C.Feature.PARALLEL is unset
sequential in interface C.ReversibleSequence<T>sequential in interface C.Sequence<T>sequential in interface C.Traversable<T>C.List<T> lazy()
Returns this traversable and make sure C.Feature.LAZY is set
lazy in interface C.ReversibleSequence<T>lazy in interface C.Sequence<T>lazy in interface C.Traversable<T>C.List<T> eager()
Returns this traversable and make sure C.Feature.LAZY is unset
eager in interface C.ReversibleSequence<T>eager in interface C.Sequence<T>eager in interface C.Traversable<T>C.List<T> snapshot()
Returns an immutable list contains all elements of the current list. If the current list is immutable, then return the current list itself.
readOnly()C.List<T> readOnly()
Returns a view of this list that is readonly. If the current list is readonly or immutable then return the current list itself
C.List<T> copy()
Returns a mutable copy of this list
C.List<T> sorted()
Returns a sorted copy of this list.
Note if the element type T is not a Comparable then this method returns a copy of this list without any order changes
C.List<T> unique()
Return a list that contains unique set of this list and keep the orders. If this list doesn’t have duplicated items, it could return this list directly or choose to return an new copy of this list depends on the sub class implementation
C.List<T> unique(Comparator<T> comp)
Return a list that contains unique set as per the comparator specified of this list and keep the orders. If this list doesn’t have duplicated items, it could return this list directly or choose to return an new copy of this list depends on the sub class implementation
comp - the comparator check the duplicate elementsC.List<T> sorted(Comparator<? super T> comparator)
Returns a sorted copy of this list. The order is specified by the comparator provided
comparator - specify the order of elements in the result listboolean addAll(Iterable<? extends T> iterable)
Add all elements from an Iterable into this list. Return true if the list has changed as a result of call.
Note if this list is immutable or readonly, UnsupportedOperationException will be thrown out with this call
iterable - the iterable provides the elements to be added into the listtrue if this list changed as result of adddC.List<T> head(int n)
Alias of C.Sequence.take(int)
head in interface C.ReversibleSequence<T>head in interface C.Sequence<T>n - specify the number of elements to be included in the return listn items in this ListC.List<T> take(int n)
Returns a Sequence consisting the first n elements from this Sequence if number n is positive and the Sequence contains more than n elements
If this Sequence contains less than n elements, then a Sequence consisting the whole elements of this Sequence is returned. Note it might return this Sequence itself if the Sequence is immutable.
If the number n is zero, then an empty Sequence is returned in reverse order
If the number n is negative, then the last -n elements from this Sequence is returned in an new Sequence, or throw UnsupportedOperationException if this operation is not supported
Sequence seq = C.list(1, 2, 3, 4); assertEquals(C.list(1, 2), seq.take(2)); assertEquals(C.list(1, 2, 3, 4), seq.take(100)); assertEquals(C.list(), seq.take(0)); assertEquals(C.list(3, 4), seq.take(-2)); assertEquals(C.list(1, 2, 3, 4), seq.take(-200));
This method does not alter the underline list
take in interface C.ReversibleSequence<T>take in interface C.Sequence<T>n - specify the number of elements to be taken from the head of this Sequencen items in this listC.Sequence.head(int)C.List<T> tail()
Returns the rest part of the Sequence except the first element
tail in interface C.ReversibleSequence<T>tail in interface C.Sequence<T>C.Sequence.head(),
C.ReversibleSequence.tail(int)C.List<T> tail(int n)
Returns a Sequence consisting the last n elements from this Sequence if number n is positive and the Sequence contains more than n elements
If this Sequence contains less than n elements, then a Sequence consisting the whole elements of this Sequence is returned. Note it might return this Sequence itself if the Sequence is immutable.
If the number n is zero, then an empty Sequence is returned in reverse order
If the number n is negative, then the first -n elements from this Sequence is returned in an new Sequence
Sequence seq = C1.list(1, 2, 3, 4); assertEquals(C1.list(3, 4), seq.tail(2)); assertEquals(C1.list(1, 2, 3, 4), seq.tail(100)); assertEquals(C1.list(), seq.tail(0)); assertEquals(C1.list(1, 2, 3), seq.tail(-3)); assertEquals(C1.list(1, 2, 3, 4), seq.tail(-200));
This method does not mutate the underline container
This method does not alter the underline list
tail in interface C.ReversibleSequence<T>n - specify the number of elements to be taken from the tail of this Sequencen items in this listC.Feature.LIMITED,
C.Featured.is(org.osgl.util.C.Feature)C.List<T> drop(int n)
Returns a Sequence consisting of the elements from this Sequence except the first n if number n is positive and the Sequence contains more than n elements
If this Sequence contains less than n elements, then an empty Sequence is returned
If the number n is zero, then a copy of this Sequence or this Sequence itself is returned depending on the implementation
If the number n is negative, then either IllegalArgumentException should be thrown out if this sequence is not C.Feature.LIMITED or it drop -n element starts from the tail side
C.Sequence seq = C.list(1, 2, 3, 4, 5); assertEquals(C.list(3, 4, 5), seq.drop(2)); assertEquals(C.list(1, 2, 3, 4, 5), seq.drop(0)); assertEquals(C.list(), seq.drop(100));
Note this method does NOT modify the current sequence, instead it returns an new sequence structure containing the elements as required
This method does not alter the underline list
drop in interface C.ReversibleSequence<T>drop in interface C.Sequence<T>n - specify the number of elements to be taken from the head of this Sequence or the -n number of elements to be taken from the tail of this sequence if n is an negative numbern numberC.List<T> dropWhile(Lang.Function<? super T,Boolean> predicate)
Returns a Sequence consisting of the elements from this sequence with leading elements dropped until the predicate returns true
Sequence seq = C.list(1, 2, 3, 4, 3, 2, 1); assertTrue(C.list(), seq.dropWhile(_.F.gt(100))); assertTrue(C.list(4, 3, 2, 1), seq.dropWhile(_.F.lt(3)));
Note this method does NOT modify the current sequence, instead it returns an new sequence structure containing the elements as required
This method does not alter the underline list
dropWhile in interface C.ReversibleSequence<T>dropWhile in interface C.Sequence<T>predicate - the predicate functionC.List<T> takeWhile(Lang.Function<? super T,Boolean> predicate)
Returns an new Sequence that takes the head of this Sequence until the predicate evaluate to false:
C.Sequence seq = C.list(1, 2, 3, 4, 5, 4, 3, 2, 1); assertEquals(C.list(C.list(1, 2, 3), seq.takeWhile(_.F.lt(4))); assertEquals(C.list(C.list(1, 2, 3, 3, 2, 1), seq.filter(_.F.lt(4)));
This method does not alter the underline list
takeWhile in interface C.ReversibleSequence<T>takeWhile in interface C.Sequence<T>predicate - specify which the elements in this Sequence will put into the new SequenceC.List<T> remove(Lang.Function<? super T,Boolean> predicate)
For mutable list, remove all element that matches the predicate specified from this List and return this list once done.
For immutable or readonly list, an new List contains all element from this list that does not match the predicate specified is returned
predicate - test whether an element should be removed frmo return list<R> C.List<R> map(Lang.Function<? super T,? extends R> mapper)
C.SequenceReturns an new traversable with a mapper function specified. The element in the new traversal is the result of the mapper function applied to this traversal element.
Traversable traversable = C.list(23, .NONE, null); assertEquals(C.list(true, false, false), traversal.map(.F.NOT_NULL)); assertEquals(C.list(“23”, "“, ”"), traversal.map(_.F.AS_STRING));
For Lazy Traversable, it must use lazy evaluation for this method. Otherwise it is up to implementation to decide whether use lazy evaluation or not
map in interface C.ReversibleSequence<T>map in interface C.Sequence<T>map in interface C.Traversable<T>R - the element type of the new traversalmapper - the function that applied to element in this traversal and returns element in the result traversalR that are mapped from this sequence<R> C.List<R> flatMap(Lang.Function<? super T,? extends Iterable<? extends R>> mapper)
Returns a traversable consisting of the results of replacing each element of this stream with the contents of the iterable produced by applying the provided mapping function to each element. If the result of the mapping function is null, this is treated as if the result is an empty traversable.
flatMap in interface C.ReversibleSequence<T>flatMap in interface C.Sequence<T>flatMap in interface C.Traversable<T>R - the element type of the the new traversablemapper - the function produce an iterable when applied to an elementR type element that are mapped from this sequences<R> C.List<R> collect(String path)
collect in interface C.Sequence<T>collect in interface C.Traversable<T>C.List<T> filter(Lang.Function<? super T,Boolean> predicate)
C.SequenceReturns an new traversable that contains all elements in the current traversable except that does not pass the test of the filter function specified.
Traversable traversable = C.list(-1, 0, 1, -3, 7); Traversable filtered = traversable.filter(_.F.gt(0)); assertTrue(filtered.contains(1)); assertFalse(filtered.contains(-3));
filter in interface C.ReversibleSequence<T>filter in interface C.Sequence<T>filter in interface C.Traversable<T>predicate - the function that test if the element in the traversable should be kept in the resulting traversable. When applying the filter function to the element, if the result is true then the element will be kept in the resulting traversable.Sequence consists of elements that passed the predicateLang.T2<C.List<T>,C.List<T>> split(Lang.Function<? super T,Boolean> predicate)
Split this list into two list based on the predicate specified.
The function use the predicate to test all elements in this list. If test passed then it add the element into left side list, otherwise the element will be added into right side list. The result is returned as a tuple contains the left and right side lift
predicate - the function to test the elements in this listC.List.Cursor<T> locateFirst(Lang.Function<T,Boolean> predicate)
Find the first element in this list that matches the predicate. Return a cursor point to the location of the element. If no such element is found then a cursor that point to -1 is returned.
predicate - test the elementC.List.Cursor<T> locate(Lang.Function<T,Boolean> predicate)
Locate any one element in the list that matches the predicate. Returns the cursor point to the element found, or a cursor that is not defined if no such element found in the list. In a parallel locating the element been found might not be the first element matches the predicate
predicate - the function that used to check the element at the cursorC.List.Cursor<T> locateLast(Lang.Function<T,Boolean> predicate)
Locate the first element in this list that matches the predicate. Return a cursor point to the location of the element. If no such element is found then a cursor that point to -1 is returned.
predicate - test the elementC.List<T> insert(int index, T t) throws IndexOutOfBoundsException
Insert an element at the position specified by index.
If this list is readonly or immutable, then an new list should be created with all elements in this list and the new element inserted at the specified position. The new list should have the same feature as this list
If index is less than zero then it will insert at (size() + index)
index - specify the position where the element should be insertedt - the element to be insertedIndexOutOfBoundsException - Math.abs(index) > size()C.List<T> insert(int index, T... ta) throws IndexOutOfBoundsException
Insert an array of elements at the position specified by index.
If this list is readonly or immutable, then an new list should be created with all elements in this list and the new element inserted at the specified position. The new list should have the same feature as this list
If index is less than zero then it will insert at (size() + index)
index - specify the position where the element should be insertedta - the array of elements to be insertedIndexOutOfBoundsException - Math.abs(index) > size()C.List<T> insert(int index, List<T> subList) throws IndexOutOfBoundsException
Insert a sub list at the position specified by index.
If this list is readonly or immutable, then an new list should be created with all elements in this list and the elements of sub list inserted at the specified position. The new list should have the same feature as this list
If index is less than zero then it will insert at (size() + index)
index - specify the position where the element should be insertedsubList - the sub list contains elements to be insertedIndexOutOfBoundsException - Math.abs(index) > size()C.List<T> append(T t)
Returns a sequence consists of all elements of this sequence followed by the element specified.
an immutable Sequence must return an new Sequence; while a mutable Sequence implementation might append the element to this sequence instance directly
append in interface C.ReversibleSequence<T>append in interface C.Sequence<T>t - the element to be appended to this sequencetC.List<T> append(Collection<? extends T> iterable)
iterable - the iterable from which elements will be appended to this listC.List<T> append(C.List<T> list)
Returns a List contains all elements in this List followed by all elements in the specified List.
A mutable List implementation might choose to add elements from the specified list directly to this list and return this list directly
For a read only or immutable list, it must create an new list to avoid update this list
list - the list in which elements will be appended to this listC.List<T> prepend(T t)
C.ReversibleSequenceReturns a sequence consists of the element specified followed by all elements of this sequence.
an immutable Sequence must return an new Sequence; while a mutable Sequence implementation might append the element to this sequence instance directly
prepend in interface C.ReversibleSequence<T>prepend in interface C.Sequence<T>t - the element to be appended to this sequencet followed this seq’s elementC.List<T> prepend(Collection<? extends T> collection)
C.List<T> reverse()
C.ReversibleSequenceReturns an new Sequence that reverse this Sequence.
reverse in interface C.ReversibleSequence<T>SequenceC.Feature.LIMITED,
C.Featured.is(org.osgl.util.C.Feature)C.List<T> without(Collection<? super T> col)
Returns a List contains all elements in this List and not in the col collection specified
col - the collection in which elements should be excluded from the result ListC.List<T> without(T element)
Returns a list contains all elements in the list except the one specified
element - the element that should not be in the resulting listC.List<T> without(T element, T... elements)
Returns a list contains all elements in the list except the ones specified
element - the element that should not be in the resulting listelements - the array contains elements that should not be in the resulting listC.List<T> accept(Lang.Visitor<? super T> visitor)
C.TraversableIterate this Traversable with a visitor function. This method does not specify the approach to iterate through this structure. The implementation might choose iterate from left to right, or vice versa. It might even choose to split the structure into multiple parts, and iterate through them in parallel
accept in interface C.ReversibleSequence<T>accept in interface C.Sequence<T>accept in interface C.Traversable<T>visitor - a function that apply to element in this Traversable. The return value of the function is ignoredTraversable instance for chained callC.List<T> each(Lang.Visitor<? super T> visitor)
C.TraversableAlias of C.Traversable.accept(Lang.Visitor)
each in interface C.ReversibleSequence<T>each in interface C.Sequence<T>each in interface C.Traversable<T>visitor - the visitor to tranverse the elementsTraversable instanceC.List<T> forEach(Lang.Visitor<? super T> visitor)
C.TraversableAlias of C.Traversable.accept(Lang.Visitor)
forEach in interface C.ReversibleSequence<T>forEach in interface C.Sequence<T>forEach in interface C.Traversable<T>visitor - the visitor functionTraversable instanceC.List<T> acceptLeft(Lang.Visitor<? super T> visitor)
C.SequenceIterate through this sequence from head to tail with the visitor function specified
acceptLeft in interface C.ReversibleSequence<T>acceptLeft in interface C.Sequence<T>visitor - the function to visit elements in this sequenceC.Traversable.accept(Lang.Visitor),
C.ReversibleSequence.acceptRight(Lang.Visitor)C.List<T> acceptRight(Lang.Visitor<? super T> visitor)
C.ReversibleSequenceIterate through this sequence from tail to head with the visitor function specified
acceptRight in interface C.ReversibleSequence<T>visitor - the function to visit elements in this sequenceC.Traversable.accept(Lang.Visitor),
C.Sequence.acceptLeft(Lang.Visitor)C.List<T> accept(Lang.IndexedVisitor<Integer,? super T> indexedVisitor)
Loop through the list and for each element, call on the indexedVisitor function specified
indexedVisitor - the function to be called on each element along with the indexC.List<T> each(Lang.IndexedVisitor<Integer,? super T> indexedVisitor)
Alias of #accept(Visitor)
indexedVisitor - the function to be called on each element along with the indexC.List<T> forEach(Lang.IndexedVisitor<Integer,? super T> indexedVisitor)
Alias of #accept(Visitor)
indexedVisitor - the function to be called on each element along with the indexC.List<T> acceptLeft(Lang.IndexedVisitor<Integer,? super T> indexedVisitor)
Loop through the list from 0 to size - 1. Call the indexedVisitor function on each element along with the index
indexedVisitor - the function to be called on each element along with the indexC.List<T> acceptRight(Lang.IndexedVisitor<Integer,? super T> indexedVisitor)
Loop through the list from size() - 1 to 0. Call the indexedVisitor function on each element along with the index
indexedVisitor - the function to be called on each element along with the index<T2> C.List<Lang.Binary<T,T2>> zip(List<T2> list)
Returns a list formed from this list and another iterable collection by combining corresponding elements in pairs. If one of the two collections is longer than the other, its remaining elements are ignored.
T2 - the type of the iterablelist - the part B to be zipped with this list<T2> C.List<Lang.Binary<T,T2>> zipAll(List<T2> list, T def1, T2 def2)
Returns a list formed from this list and another iterable collection by combining corresponding elements in pairs. If one of the two collections is longer than the other, placeholder elements are used to extend the shorter collection to the length of the longer.
T2 - the type of the iterablelist - the part B to be zipped with this listdef1 - the element to be used to fill up the result if this sequence is shorter than that iterabledef2 - the element to be used to fill up the result if the iterable is shorter than this sequenceC.Sequence<Lang.Binary<T,Integer>> zipWithIndex()
Zip this sequence with its indices
zipWithIndex in interface C.Sequence<T><K,V> C.Map<K,V> toMap(Lang.Function<? super T,? extends K> keyExtractor, Lang.Function<? super T,? extends V> valExtractor)
Create a Map from this list using a key extract function and a value extract function
The key extractor will take the element stored in this list and calculate a key, and then store the element being used along with the key calculated into the map to be returned.
The value extractor will take the element stored in this list and calculate a value, and then store the element as the key along with the outcome as the value
K - the generic type of key in the mapV - the generic type of value in the mapkeyExtractor - the function that generate map key from the element in this listvalExtractor - the function that generate map value from the element in this list<K> C.Map<K,T> toMapByVal(Lang.Function<? super T,? extends K> keyExtractor)
Create a Map from this list using a key extract function.
The key extractor will take the element stored in this list and calculate a key, and then store the element being used along with the key calculated into the map to be returned.
K - the generic type of key in the mapkeyExtractor - the function that generate map key from the element in this list<V> C.Map<T,V> toMapByKey(Lang.Function<? super T,? extends V> valExtractor)
Create a Map from this list using a value extract function.
The value extractor will take the element stored in this list and calculate a value, and then store the element as the key along with the outcome as the value
V - the generic type of value in the mapvalExtractor - the function that generate map value from the element in this listCopyright © 2014–2019 OSGL (Open Source General Library). All rights reserved.