public class C extends Object
The namespace for OSGL collection utilities
| Modifier and Type | Class and Description |
|---|---|
static class |
C._CollectStage |
static class |
C._CollectStage2 |
static class |
C._FilterStage<T> |
static class |
C._FilterStage2<T> |
static class |
C._MapStage<T> |
static class |
C._MapStage2<T,R> |
static class |
C.Array<T> |
static class |
C.F
the namespace of function definitions relevant to Collection manipulation
|
static class |
C.Feature
The character enum for a data structure
|
static interface |
C.Featured
Define a type that holds a set of
C.Feature |
static interface |
C.List<T>
The osgl List interface is a mixture of
List and osgl C.Sequence |
static interface |
C.ListFactory
Defines a factory to create
java List instance used by DelegatingList to create it’s backing data structure |
static interface |
C.ListOrSet<T> |
static class |
C.Map<K,V> |
static class |
C.Mutable |
static interface |
C.Range<ELEMENT>
Define a Range data structure which contains a discrete sequence of elements start from
C.Range.from() until C.Range.to(). |
static interface |
C.ReversibleSequence<T>
A bidirectional sequence which can be iterated from tail to head
|
static interface |
C.Sequence<T> |
static interface |
C.Set<T> |
static interface |
C.Traversable<T>
Define a traversable structure with functional programming support, including map, reduce etc.
|
| Modifier and Type | Field and Description |
|---|---|
static String |
CONF_LINKED_LIST_FACTORY
“osgl.list.factory”, the property key to configure user defined
list factory. |
static String |
CONF_RANDOM_ACCESS_LIST_FACTORY
“osgl.random_access_list.factory”, the property key to configure user defined
random access list factory. |
static C.ListOrSet |
EMPTY |
static C.List |
EMPTY_LIST |
static C.Map |
EMPTY_MAP |
static C.Set |
EMPTY_SET |
| Modifier and Type | Method and Description |
|---|---|
static <T> Collection<T> |
asCollection(Iterable<T> iterable) |
static C._CollectStage |
collect(Iterable source) |
static <T> C.List<T> |
collect(Iterable source,
String propertyPath) |
static C._CollectStage2 |
collect(String propertyPath) |
static <T> C.List<T> |
concat(C.List<T> l1,
C.List<T> l2)
Concatenate two
List into one. |
static <T> C.ReversibleSequence<T> |
concat(C.ReversibleSequence<T> s1,
C.ReversibleSequence<T> s2)
Concatenate two
C.ReversibleSequence into one |
static <T> C.Sequence<T> |
concat(C.Sequence<T> s1,
C.Sequence<T> s2)
Concatenate two
C.Sequence into one |
static <T> C.ListOrSet<T> |
empty() |
static boolean |
empty(Collection<?> col) |
static boolean |
empty(Map map) |
static <T> C.List<T> |
emptyListOf(Class<T> c) |
static <T> Iterable<T> |
enumerable(Enumeration<T> e)
Convert a
Enumeration to an Iterable |
static C.Range<Integer> |
evenNumbers()
|
static <PROPERTY> C.List<PROPERTY> |
extract(Collection<?> collection,
String propertyPath)
Alias of
collect(Iterable, String) |
static <T> C._FilterStage<T> |
filter(Iterable<? extends T> source) |
static <T> C.Sequence<T> |
filter(Iterable<? extends T> iterable,
Lang.Function<? super T,Boolean> predicate) |
static <T> C._FilterStage2<T> |
filter(Lang.Predicate<? super T> predicate) |
static <T> void |
forEach(Iterable<? extends T> iterable,
Lang.Visitor<? super T> visitor)
Run visitor function on each element supplied by the iterable.
|
static <T> void |
forEach(Iterator<? extends T> iterator,
Lang.Visitor<? super T> visitor)
Run visitor function on each element supplied by the iterator.
|
static <K,V> void |
forEach(Map<K,V> map,
Lang.IndexedVisitor<? super K,? super V> indexedVisitor)
Run indexedVisitor function on all key/value pair in a given map.
|
static <T> C.Set<T> |
intercectionOf(Collection<? extends T> col1,
Collection<? extends T> col2) |
static <T> C.Set<T> |
interceptionOf(Collection<? extends T> col1,
Collection<? extends T> col2,
Collection<? extends T> col3,
Collection<? extends T>... otherCols) |
static boolean |
isEmpty(Collection<?> col) |
static boolean |
isEmpty(Map map) |
static boolean |
isImmutable(C.Traversable<?> t)
Check if a
C.Traversable structure is immutable. |
static boolean |
isReadOnly(C.Traversable<?> t)
Check if a
C.Traversable structure is read only. |
static <PROPERTY> C.Sequence<PROPERTY> |
lazyExtract(Iterable<?> iterable,
String propertyPath) |
static <T> C.List<T> |
list()
Returns an empty immutable list
|
static C.List<Boolean> |
list(boolean[] elements)
Create an immutable Boolean list of a byte (primitive type) array.
|
static C.List<Byte> |
list(byte[] elements)
Create an immutable Byte list of a byte (primitive type) array.
|
static C.List<Character> |
list(char[] elements)
Create an immutable Character list of a char array.
|
static <T> C.List<T> |
list(Collection<? extends T> col) |
static C.List<Double> |
list(double[] elements)
Create an immutable Byte list of a double array.
|
static <T> C.List<T> |
list(Enumeration<? extends T> enumeration) |
static C.List<Float> |
list(float[] elements)
Create an immutable byte list of a float array.
|
static C.List<Integer> |
list(int[] elements)
Create an immutable integer list of a int array.
|
static <T> C.List<T> |
list(Iterable<? extends T> iterable) |
static <T> C.List<T> |
list(Iterator<? extends T> iterator) |
static <T> C.List<T> |
list(List<? extends T> javaList) |
static C.List<Long> |
list(long[] elements)
Create an immutable Long list of a long array.
|
static C.List<Short> |
list(short[] elements)
Create an immutable Short list of a short array.
|
static <T> C.List<T> |
list(T t) |
static <T> C.List<T> |
list(T t,
T... ta)
Creates an immutable list from an element plus an array of elements
|
static C.List<Boolean> |
listOf(boolean[] elements)
Create an immutable Boolean list from a boolean (primitive type) array.
|
static C.List<Byte> |
listOf(byte[] elements)
Create an immutable Byte list from a byte (primitive type) array.
|
static C.List<Character> |
listOf(char[] elements)
Create an immutable Short list from a char (primitive type) array.
|
static C.List<Double> |
listOf(double[] elements)
Create an immutable Double list from an double (primitive type) array.
|
static C.List<Float> |
listOf(float[] elements)
Create an immutable Float list from a float (primitive type) array.
|
static C.List<Integer> |
listOf(int[] elements)
Create an immutable Integer list from an int (primitive type) array.
|
static C.List<Long> |
listOf(long[] elements)
Create an immutable Long list from a long (primitive type) array.
|
static C.List<Short> |
listOf(short[] elements)
Create an immutable Short list from a short (primitive type) array.
|
static <T> C.List<T> |
listOf(T... ta)
Creates an immutable list of an array of elements.
|
static <K,V> C.Map<K,V> |
Map(boolean readOnly,
Map<K,V> map) |
static <T,R> C.ReversibleSequence<R> |
map(C.ReversibleSequence<? extends T> seq,
Lang.Function<? super T,? extends R> mapper) |
static <K,V> C.Map<K,V> |
Map(Collection<Lang.Tuple<K,V>> kvCol) |
static <T> C._MapStage<T> |
map(Iterable<? extends T> source) |
static <T,R> C.Sequence<R> |
map(Iterable<? extends T> seq,
Lang.Function<? super T,? extends R> mapper) |
static <T,R> C._MapStage2 |
map(Lang.Function<? super T,? extends R> mapper) |
static <K,V> C.Map<K,V> |
Map(Map<? extends K,? extends V> map)
|
static <K,V> C.Map<K,V> |
Map(Object... args)
Create a immutable
Map from elements specified in an array. |
static C.Range<Integer> |
naturalNumbers()
|
static <T> C.List<T> |
newList() |
static <T> C.List<T> |
newList(Iterable<? extends T> iterable) |
static <T> C.List<T> |
newList(T t) |
static <T> C.List<T> |
newList(T t1,
T t2) |
static <T> C.List<T> |
newList(T t1,
T t2,
T t3) |
static <T> C.List<T> |
newList(T t1,
T t2,
T t3,
T... ta) |
static <T> C.List<T> |
newListOf(T[] ts) |
static <K,V> C.Map<K,V> |
newMap(Map<? extends K,? extends V> map)
|
static <K,V> C.Map<K,V> |
newMap(Object... args)
Create an new
Map from an array of elements. |
static <T> C.Set<T> |
newSet()
Create an new empty set
|
static <T> C.Set<T> |
newSet(Collection<? extends T> col)
Create an new set with all elements contained in the collection specified
|
static <T> C.Set<T> |
newSet(T t1,
T... ta)
Create an mutable set contains specified elements
|
static <T> C.List<T> |
newSizedList(int size) |
static boolean |
notEmpty(Collection<?> col) |
static boolean |
notEmpty(Map map) |
static C.Range<Integer> |
oddNumbers()
|
static <T> C.Sequence<T> |
prepend(T t,
C.Sequence<T> sequence) |
static C.Range<Byte> |
range(byte from,
byte to)
|
static C.Range<Integer> |
range(int from,
int to)
|
static C.Range<Long> |
range(long from,
long to)
|
static C.Range<Short> |
range(short from,
short to)
|
static <T> C.Sequence<T> |
seq(Enumeration<? extends T> enumeration) |
static <T> C.Sequence<T> |
seq(Iterable<? extends T> iterable)
Return a
C.Sequence consists of all elements in the iterable specified |
static <T> C.Sequence<T> |
seq(Iterator<? extends T> iterator) |
static <T> C.Set<T> |
set()
Deprecated.
|
static <T> C.Set<T> |
Set()
Create an empty immutable set
|
static <T> C.Set<T> |
set(Collection<? extends T> col)
Deprecated.
|
static <T> C.Set<T> |
Set(Collection<? extends T> col)
Create an immutable set of all elements contained in the collection specified
|
static <T> C.Set<T> |
set(Iterable<? extends T> itr)
Create an immutable set of all elements supplied by the iterable specified
|
static <T> C.Set<T> |
set(T element)
Create an immutable set of a single element
|
static <T> C.Set<T> |
set(T t1,
T... ta)
Create an immutable set contains specified elements
|
static <T> C.Set<T> |
setOf(T... ta)
Create an immutable set of an array of elements
|
static <T> C.List<T> |
singletonList(T t) |
static <T> C.Set<T> |
unionOf(Collection<? extends T> col1,
Collection<? extends T> col2) |
static <T> C.Set<T> |
unionOf(Collection<? extends T> col1,
Collection<? extends T> col2,
Collection<? extends T> col3,
Collection<? extends T>... otherCols) |
static <T> C.List<T> |
wrap(List<T> list) |
public static final String CONF_LINKED_LIST_FACTORY
“osgl.list.factory”, the property key to configure user defined list factory. Upon loaded, osgl tried to get a class name string from system properties use this configuration key. If osgl find the String returned is not empty then it will initialize the list factory use the class name configured. If any exception raised during the initialization, then it might cause the JVM failed to boot up
public static final String CONF_RANDOM_ACCESS_LIST_FACTORY
“osgl.random_access_list.factory”, the property key to configure user defined random access list factory. See CONF_LINKED_LIST_FACTORY for how osgl use this configuration
public static final C.List EMPTY_LIST
public static final C.Set EMPTY_SET
public static final C.Map EMPTY_MAP
public static final C.ListOrSet EMPTY
public static boolean empty(Collection<?> col)
public static boolean notEmpty(Collection<?> col)
public static boolean isEmpty(Collection<?> col)
public static boolean empty(Map map)
public static boolean notEmpty(Map map)
public static boolean isEmpty(Map map)
public static <T> Collection<T> asCollection(Iterable<T> iterable)
public static C.Range<Integer> range(int from, int to)
Returns a C.Range of integer specified by from and to. from can be less or larger than to.
from - specify the left side of the range (inclusive)to - specify the right hand side of the range (exclusive)public static C.Range<Byte> range(byte from, byte to)
Returns a C.Range of byte specified by from and to. from can be less or larger than to.
from - specify the left side of the range (inclusive)to - specify the right hand side of the range (exclusive)public static C.Range<Short> range(short from, short to)
Returns a C.Range of short specified by from and to. from can be less or larger than to.
from - specify the left side of the range (inclusive)to - specify the right hand side of the range (exclusive)public static C.Range<Long> range(long from, long to)
Returns a C.Range of long specified by from and to. from can be less or larger than to.
from - specify the left side of the range (inclusive)to - specify the right hand side of the range (exclusive)public static C.Range<Integer> naturalNumbers()
Returns a C.Range of non-negative integers start from 0 to Integer.MAX_VALUE. Note unlike traditional definition of natural number, zero is included in the range returned
public static C.Range<Integer> evenNumbers()
Returns a C.Range of non-negative even numbers starts from 0 to Integer.MAX_VALUE.
public static C.Range<Integer> oddNumbers()
Returns a C.Range of positive odd numbers starts from 1 to Integer.MAX_VALUE.
public static <T> C.ListOrSet<T> empty()
public static <T> C.List<T> list()
Returns an empty immutable list
T - the type of the list elementpublic static <T> C.List<T> list(T t)
public static <T> C.List<T> listOf(T... ta)
Creates an immutable list of an array of elements.
Note the array will not be copied, instead it will be used directly as the backing data for the list. To create an list with a copy of the array specified. Use the newListOf(Object[]) method
T - the element typeta - an array of elementspublic static <T> C.List<T> list(T t, T... ta)
Creates an immutable list from an element plus an array of elements
T - the element typet - the first elementta - the arraypublic static C.List<Boolean> listOf(boolean[] elements)
Create an immutable Boolean list from a boolean (primitive type) array.
At the moment the implementation will convert the boolean (primary) array to Boolean (wraper) array, thus a copy of the array will actually take place. However it should assume the array will directly be used as backing data in user application to cater to the future optimized implementation
elements - an array of primary booleanpublic static C.List<Boolean> list(boolean[] elements)
Create an immutable Boolean list of a byte (primitive type) array. The elements of the array is copied into the returned list
elements - an array of bytespublic static C.List<Byte> listOf(byte[] elements)
Create an immutable Byte list from a byte (primitive type) array.
At the moment the implementation will convert the byte (primary) array to Byte (reference) array, thus a copy of the array will actually take place. However it should assume the array will directly be used as backing data in user application to cater to the future optimized implementation
elements - an array of primary bytepublic static C.List<Byte> list(byte[] elements)
Create an immutable Byte list of a byte (primitive type) array. The elements of the array is copied into the returned list
elements - an array of bytespublic static C.List<Character> listOf(char[] elements)
Create an immutable Short list from a char (primitive type) array.
At the moment the implementation will convert the char (primary) array to Character (reference) array, thus a copy of the array will actually take place. However it should assume the array will directly be used as backing data in user application to cater to the future optimized implementation
elements - an array of primary shortpublic static C.List<Character> list(char[] elements)
Create an immutable Character list of a char array. The elements of the array is copied into the returned list
elements - an array of shortspublic static C.List<Short> listOf(short[] elements)
Create an immutable Short list from a short (primitive type) array.
At the moment the implementation will convert the short (primary) array to Short (reference) array, thus a copy of the array will actually take place. However it should assume the array will directly be used as backing data in user application to cater to the future optimized implementation
elements - an array of primary shortpublic static C.List<Short> list(short[] elements)
Create an immutable Short list of a short array. The elements of the array is copied into the returned list
elements - an array of shortspublic static C.List<Integer> listOf(int[] elements)
Create an immutable Integer list from an int (primitive type) array.
At the moment the implementation will convert the int (primary) array to Integer (reference) array, thus a copy of the array will actually take place. However it should assume the array will directly be used as backing data in user application to cater to the future optimized implementation
elements - an array of primary intpublic static C.List<Integer> list(int[] elements)
Create an immutable integer list of a int array. If an empty array specified, the nan empty immutable list is returned
elements - an array of intpublic static C.List<Long> listOf(long[] elements)
Create an immutable Long list from a long (primitive type) array.
At the moment the implementation will convert the long (primary) array to Long (reference) array, thus a copy of the array will actually take place. However it should assume the array will directly be used as backing data in user application to cater to the future optimized implementation
elements - an array of primary longpublic static C.List<Long> list(long[] elements)
Create an immutable Long list of a long array. If an empty array specified, the nan empty immutable list is returned
elements - an array of longpublic static C.List<Float> listOf(float[] elements)
Create an immutable Float list from a float (primitive type) array.
At the moment the implementation will convert the float (primary) array to Float (reference) array, thus a copy of the array will actually take place. However it should assume the array will directly be used as backing data in user application to cater to the future optimized implementation
elements - an array of primary floatpublic static C.List<Float> list(float[] elements)
Create an immutable byte list of a float array. If an empty array specified, the nan empty immutable list is returned
elements - an array of floatspublic static C.List<Double> listOf(double[] elements)
Create an immutable Double list from an double (primitive type) array.
At the moment the implementation will convert the double (primary) array to Double (reference) array, thus a copy of the array will actually take place. However it should assume the array will directly be used as backing data in user application to cater to the future optimized implementation
elements - an array of primary doublepublic static C.List<Double> list(double[] elements)
Create an immutable Byte list of a double array. If an empty array specified, the nan empty immutable list is returned
elements - an array of doublepublic static <T> C.List<T> list(Enumeration<? extends T> enumeration)
public static <T> C.List<T> list(Collection<? extends T> col)
public static <T> C.List<T> singletonList(T t)
public static <T> C.List<T> newSizedList(int size)
public static <T> C.List<T> newList()
public static <T> C.List<T> newList(T t)
public static <T> C.List<T> newList(T t1, T t2)
public static <T> C.List<T> newList(T t1, T t2, T t3)
public static <T> C.List<T> newList(T t1, T t2, T t3, T... ta)
public static <T> C.List<T> newListOf(T[] ts)
public static <T> C.Sequence<T> seq(Iterable<? extends T> iterable)
Return a C.Sequence consists of all elements in the iterable specified
T - the element typeiterable - the iterable in which elements will be used to fill into the sequencepublic static <T> C.Sequence<T> seq(Iterator<? extends T> iterator)
public static <T> C.Sequence<T> seq(Enumeration<? extends T> enumeration)
public static <PROPERTY> C.List<PROPERTY> extract(Collection<?> collection, String propertyPath)
Alias of collect(Iterable, String)
PROPERTY - collection - propertyPath - public static <PROPERTY> C.Sequence<PROPERTY> lazyExtract(Iterable<?> iterable, String propertyPath)
public static <T,R> C.Sequence<R> map(Iterable<? extends T> seq, Lang.Function<? super T,? extends R> mapper)
public static <T,R> C.ReversibleSequence<R> map(C.ReversibleSequence<? extends T> seq, Lang.Function<? super T,? extends R> mapper)
public static <T> C.Sequence<T> filter(Iterable<? extends T> iterable, Lang.Function<? super T,Boolean> predicate)
public static <T> C.Sequence<T> prepend(T t, C.Sequence<T> sequence)
public static <T> C.Sequence<T> concat(C.Sequence<T> s1, C.Sequence<T> s2)
Concatenate two C.Sequence into one
T - the element types1 - the first sequences2 - the second sequencepublic static <T> C.ReversibleSequence<T> concat(C.ReversibleSequence<T> s1, C.ReversibleSequence<T> s2)
Concatenate two C.ReversibleSequence into one
T - the element types1 - the first reversible sequences2 - the second reversible sequencepublic static <T> C.List<T> concat(C.List<T> l1, C.List<T> l2)
Concatenate two List into one.
Note if the first list is readonly or immutable an new list instance will be created with elements in both list 1 and list 2 filled in. Otherwise all elemnets from list 2 will be appended to list 1 and return list 1 instance
T - the element typel1 - list 1l2 - list 2@Deprecated public static <T> C.Set<T> set()
This method is deprecated. Please use Set() instead
public static <T> C.Set<T> Set()
Create an empty immutable set
T - the generic typepublic static <T> C.Set<T> set(T element)
Create an immutable set of a single element
T - the element typeelement - the single elementpublic static <T> C.Set<T> set(T t1, T... ta)
Create an immutable set contains specified elements
T - the element typet1 - one element to be added into the result setta - an array from which all elements will be added into the result setpublic static <T> C.Set<T> setOf(T... ta)
Create an immutable set of an array of elements
T - the element typeta - the array from which all elements will be added into the result set@Deprecated public static <T> C.Set<T> set(Collection<? extends T> col)
This method is deprecated. Please use Set(Collection) instead
public static <T> C.Set<T> Set(Collection<? extends T> col)
Create an immutable set of all elements contained in the collection specified
T - the element typecol - the collection from which elements will be added into the result setnewSet(Collection)public static <T> C.Set<T> set(Iterable<? extends T> itr)
Create an immutable set of all elements supplied by the iterable specified
T - the element typeitr - the iterable from where elements will be added into the result setpublic static <T> C.Set<T> newSet()
Create an new empty set
T - the element typepublic static <T> C.Set<T> newSet(T t1, T... ta)
Create an mutable set contains specified elements
T - the element typet1 - one element to be added into the result setta - an array from which all elements will be added into the result setpublic static <T> C.Set<T> newSet(Collection<? extends T> col)
Create an new set with all elements contained in the collection specified
T - the element typecol - the collection from which all elements will be added into the result setset(Collection)public static <T> C.Set<T> unionOf(Collection<? extends T> col1, Collection<? extends T> col2)
public static <T> C.Set<T> unionOf(Collection<? extends T> col1, Collection<? extends T> col2, Collection<? extends T> col3, Collection<? extends T>... otherCols)
public static <T> C.Set<T> intercectionOf(Collection<? extends T> col1, Collection<? extends T> col2)
public static <T> C.Set<T> interceptionOf(Collection<? extends T> col1, Collection<? extends T> col2, Collection<? extends T> col3, Collection<? extends T>... otherCols)
public static <K,V> C.Map<K,V> Map(Object... args)
Create a immutable Map from elements specified in an array.
Example
Map<String, Integer> scores = C.map(“Tom”, 80, “Peter”, 93, …);
The above code will create an immutable Map with the following entries
Note the array size must be an even number, otherwise IndexOutOfBoundsException will be thrown out
K - the key typeV - the value typeargs - the argument array specifies the entriesnewMap(Object...)public static <K,V> C.Map<K,V> Map(Collection<Lang.Tuple<K,V>> kvCol)
public static <K,V> C.Map<K,V> Map(Map<? extends K,? extends V> map)
K - the key typeV - the value typemap - the map from which entries will be put into the new immutable mappublic static <K,V> C.Map<K,V> newMap(Object... args)
Create an new Map from an array of elements.
Example
Map<String, Integer> scores = C.newMap(“Tom”, 80, “Peter”, 93, …);
The above code will create a Map with the following entries
Note the array size must be an even number, otherwise IndexOutOfBoundsException will be thrown out
K - the key typeV - the value typeargs - the argument array specifies the entriesMap(Object...)public static <K,V> C.Map<K,V> newMap(Map<? extends K,? extends V> map)
K - the key typeV - the value typemap - the map that contains elements to be put into the new mappublic static <T> Iterable<T> enumerable(Enumeration<T> e)
Convert a Enumeration to an Iterable
T - the element typee - the enumerationpublic static boolean isReadOnly(C.Traversable<?> t)
Check if a C.Traversable structure is read only. A Traversable is considered to be read only structure when is(Feature.READONLY) || is(Feature.IMMUTABLE evaluate to true
t - the structure to be checkedtrue if the structure is read only or immutablepublic static boolean isImmutable(C.Traversable<?> t)
Check if a C.Traversable structure is immutable.
t - the traversable strucure to be checkedtrue if the traversable is immutablepublic static <T> void forEach(Iterable<? extends T> iterable, Lang.Visitor<? super T> visitor) throws Lang.Break
Run visitor function on each element supplied by the iterable. The visitor function can throw out Lang.Break if it need to break the loop.
Note if NotAppliedException thrown out by visitor function, it will be ignored and keep looping through the Map entry set. It is kind of continue mechanism in a funcitonal way
T - the generic type of the iterable elementsiterable - supply the element to be applied to the visitor functionvisitor - the function called on element provided by the iterable$.Break - break the loopLang.Breakpublic static <T> void forEach(Iterator<? extends T> iterator, Lang.Visitor<? super T> visitor)
Run visitor function on each element supplied by the iterator. The visitor function can throw out Lang.Break if it need to break the loop.
Note if NotAppliedException thrown out by visitor function, it will be ignored and keep looping through the Map entry set. It is kind of continue mechanism in a funcitonal way
T - the generic type of the elementiterator - iterator provides elements to be applied to the visitor functionvisitor - the function applied on the elementpublic static <K,V> void forEach(Map<K,V> map, Lang.IndexedVisitor<? super K,? super V> indexedVisitor) throws Lang.Break
Run indexedVisitor function on all key/value pair in a given map. The indexedVisitor function can throw out Lang.Break if it need to break the loop.
Note if NotAppliedException thrown out by indexedVisitor function, it will be ignored and keep looping through the Map entry set. It is kind of continue mechanism in a funcitonal way
K - the generic type of KeyV - the generic type of Valuemap - the map in which enties will be applied to the indexedVisitor functionindexedVisitor - the function that takes (key,value) pair$.Break - the Lang.Break with payload throwed out by indexedVisitor function to break to loopLang.Breakpublic static C._CollectStage collect(Iterable source)
public static C._CollectStage2 collect(String propertyPath)
public static <T> C._MapStage<T> map(Iterable<? extends T> source)
public static <T,R> C._MapStage2 map(Lang.Function<? super T,? extends R> mapper)
public static <T> C._FilterStage<T> filter(Iterable<? extends T> source)
public static <T> C._FilterStage2<T> filter(Lang.Predicate<? super T> predicate)
Copyright © 2014–2019 OSGL (Open Source General Library). All rights reserved.