public class Seq extends Object
Modifier and Type | Class and Description |
---|---|
static interface |
Seq.Multiop |
static interface |
Seq.Operation |
protected static interface |
Seq.SeqAdapter |
Modifier and Type | Field and Description |
---|---|
protected static Seq.SeqAdapter |
arrayAdapter |
protected static Seq.SeqAdapter |
charSequenceAdapter |
protected static Seq.SeqAdapter |
immutableListAdapter |
protected static Seq.SeqAdapter |
immutableMapAdapter |
protected static Seq.SeqAdapter |
immutableSetAdapter |
protected static Seq.SeqAdapter |
listAdapter |
protected static Seq.SeqAdapter |
mapAdapter |
protected static Seq.SeqAdapter |
nullAdapter |
protected static Seq.SeqAdapter |
setAdapter |
protected static Seq.SeqAdapter |
stringAdapter |
protected static Seq.SeqAdapter |
stringBufferAdapter |
protected static Seq.SeqAdapter |
stringBuilderAdapter |
Constructor and Description |
---|
Seq() |
Modifier and Type | Method and Description |
---|---|
static Object |
addValue(Object seq,
Object value)
Add value to sequence.
|
static Set<?> |
asSet(Object obj)
Return sequence objects as Set.
|
static boolean |
containsElement(Object seq,
Object obj)
Check if sequence contains object.
|
static boolean |
containsKey(Object seq,
Object key)
Check if an associative collection contains key.
|
static boolean |
doGet(Object obj,
Object[] result,
Object keyObj)
Get data object from nested data structures.
|
static Object |
doGetIn(Object obj,
Object ksObj,
int ksIdx,
Object notDefined)
Get data object from nested data structures.
|
static int |
forEach(Object seq,
Seq.Operation op,
boolean allowNonSeq)
Run operation op on all objects in sequence.
|
protected static Seq.SeqAdapter |
getAssociativeSeqAdapter(Object seq) |
static Object |
getElementByIndex(Object seq,
int index)
Get sequence element by index.
|
static Object |
getElementByKeyOrIndex(Object seq,
Object key)
Get sequence element by key.
|
protected static int |
getIntIdx(Object key) |
protected static Object |
getKeyByIndex(Object ksObj,
int ksIdx) |
static int |
getLength(Object val,
boolean allowNonSeq)
Get length of sequence.
|
protected static Seq.SeqAdapter |
getSeqAdapter(Object seq) |
static Object |
insertElementByIndex(Object seq,
int index,
Object element)
put sequence element by index.
|
static boolean |
isAssociative(Object obj)
Check if object supports associative addressing (indices or keys).
|
static boolean |
isCollection(Object obj)
Check if object is a supported collection.
|
static boolean |
isIndexed(Object obj)
Check if object is an indexed sequence.
|
static boolean |
isMap(Object obj)
Check if object is a set.
|
static boolean |
isSeq(Object obj)
Check if object is a supported sequence.
|
static boolean |
isSet(Object obj)
Check if object is a set.
|
static String |
joinWithString(Object seqObj,
String sep)
Join sequence with string separator.
|
static List<Object> |
mapall(Seq.Multiop op,
Object... seqs)
Perform operation on all objects of the given sequences.
|
static int |
maxLength(Object... seqs)
Get maximal length of given sequences.
|
static int |
minLength(Object... seqs)
Get minimal length of given sequences.
|
static Object |
putElement(Object seq,
Object key,
Object element)
Put element into associative structure by key or index.
|
static Object |
putToMap(Map<Object,Object> m,
Object key,
Object value) |
static Object |
refElementByIndex(Object seq,
int index)
Get sequence element by index.
|
static Object |
removeElementByIndex(Object seq,
int index)
Remove sequence element by index.
|
static Object |
removeElementByKeyOrIndex(Object seq,
Object key)
Remove element from sequence by key or index.
|
static Object |
removeLastElement(Object seq)
Remove last element of indexed sequence or arbitrary
from a set.
|
static Object |
roAddValue(Object seq,
Object value) |
static Object |
roInsertElementByIndex(Object seq,
int index,
Object element)
Put sequence element by index.
|
static Object |
roPutElement(Object seq,
Object key,
Object element)
put sequence element by key.
|
static Object |
roPutToMap(Map<Object,Object> m,
Object key,
Object value) |
static Object |
roRemoveElementByKeyOrIndex(Object seq,
Object key)
Remove element from sequence by key or index.
|
static List<Object> |
roRemoveLastElement(Object seq)
Non-mutating remove last element.
|
static Object |
roSetElementByIndex(Object seq,
int index,
Object element) |
static boolean |
sequal(Map<?,?> m1,
Map<?,?> m2)
Compare maps contents.
|
static boolean |
sequal(Object o1,
Object o2)
Compare objects, for sequences compare sequence contents.
|
static Object |
setElement(Object seq,
Object key,
Object element)
put sequence element by key.
|
static Object |
setElementByIndex(Object seq,
int index,
Object element)
put sequence element by index.
|
static Object |
shallowClone(Object seq) |
static List<Object> |
valuesList(Object seq)
Return new list with all elements of given sequence.
|
protected static final Seq.SeqAdapter listAdapter
protected static final Seq.SeqAdapter immutableListAdapter
protected static final Seq.SeqAdapter immutableSetAdapter
protected static final Seq.SeqAdapter setAdapter
protected static final Seq.SeqAdapter stringBufferAdapter
protected static final Seq.SeqAdapter stringBuilderAdapter
protected static final Seq.SeqAdapter stringAdapter
protected static final Seq.SeqAdapter charSequenceAdapter
protected static final Seq.SeqAdapter arrayAdapter
protected static final Seq.SeqAdapter mapAdapter
protected static final Seq.SeqAdapter immutableMapAdapter
protected static final Seq.SeqAdapter nullAdapter
public static boolean isCollection(Object obj)
public static boolean isSeq(Object obj)
public static boolean isIndexed(Object obj)
public static boolean isSet(Object obj)
public static boolean isMap(Object obj)
public static boolean isAssociative(Object obj)
public static int forEach(Object seq, Seq.Operation op, boolean allowNonSeq)
If allowNonSeq is true then run operation on object that is not a sequence.
public static boolean containsKey(Object seq, Object key)
public static boolean containsElement(Object seq, Object obj)
public static Object getElementByKeyOrIndex(Object seq, Object key)
public static Object removeLastElement(Object seq)
public static List<Object> roRemoveLastElement(Object seq)
public static Object removeElementByKeyOrIndex(Object seq, Object key)
public static Object roRemoveElementByKeyOrIndex(Object seq, Object key)
protected static Seq.SeqAdapter getSeqAdapter(Object seq)
protected static Seq.SeqAdapter getAssociativeSeqAdapter(Object seq)
public static Object getElementByIndex(Object seq, int index)
public static Object refElementByIndex(Object seq, int index)
public static Object removeElementByIndex(Object seq, int index)
public static Object putElement(Object seq, Object key, Object element)
public static Object roPutElement(Object seq, Object key, Object element)
public static Object setElementByIndex(Object seq, int index, Object element) throws IndexOutOfBoundsException
IndexOutOfBoundsException
public static Object insertElementByIndex(Object seq, int index, Object element) throws IndexOutOfBoundsException
IndexOutOfBoundsException
public static Object roInsertElementByIndex(Object seq, int index, Object element) throws IndexOutOfBoundsException
IndexOutOfBoundsException
public static Object setElement(Object seq, Object key, Object element) throws IndexOutOfBoundsException
IndexOutOfBoundsException
public static int getLength(Object val, boolean allowNonSeq)
public static List<Object> valuesList(Object seq)
public static int maxLength(Object... seqs)
public static int minLength(Object... seqs)
public static List<Object> mapall(Seq.Multiop op, Object... seqs)
public static boolean sequal(Object o1, Object o2)
public static boolean doGet(Object obj, Object[] result, Object keyObj)
public static Object doGetIn(Object obj, Object ksObj, int ksIdx, Object notDefined)
protected static int getIntIdx(Object key)
Copyright © 2022. All rights reserved.