Package gnu.lists
Class Sequences
- java.lang.Object
-
- gnu.lists.Sequences
-
public class Sequences extends Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Sequences.CharacterIterator
Iterator subclass to iterate of CharSequences.
-
Constructor Summary
Constructors Constructor Description Sequences()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static GVector
asGVector(Object value)
static GVector
asGVectorOrNull(Object value)
static IntSequence
asIntSequenceOrNull(Object value)
static List
asSequenceOrNull(Object value)
static List
coerceToSequence(Object value)
static SimpleVector
copy(SimpleVector base, int start, int end, boolean writable)
static SimpleVector
copy(List base, Range.IntRange range, boolean writable)
static boolean
copyInPlaceIsSafe(Object src, Object dst)
static SimpleVector
copySimple(SimpleVector base, int start, int end, boolean writable)
Do a logical substring operation with sharing.static Object
drop(Object base, int count)
static Object
drop(Object base, int fromStart, int fromEnd)
static Object
getAt(List seq, int index)
static Iterator
getIterator(Object object)
Get an Iterator for a "sequence-like" object.static int
getSize(Object values)
static List
indirectIndexed(List lst, IntSequence indexes)
static void
replace(List lst, int fromStart, int fromEnd, List values)
static Object
subList(Object base, int fromIndex, int toIndex)
static void
writeUInt(int value, Consumer out)
static void
writeULong(long value, Consumer out)
-
-
-
Method Detail
-
asIntSequenceOrNull
public static IntSequence asIntSequenceOrNull(Object value)
-
getSize
public static int getSize(Object values)
-
getIterator
public static Iterator getIterator(Object object)
Get an Iterator for a "sequence-like" object. This handles Iterables, CharSequences, and Java arrays. A CharSequences is treated as a sequence of (20-bit) code-points, not 16-bit char values.
-
indirectIndexed
public static List indirectIndexed(List lst, IntSequence indexes)
-
copySimple
public static SimpleVector copySimple(SimpleVector base, int start, int end, boolean writable)
Do a logical substring operation with sharing. Requires base.isVerySimple() || base.isSubRange(). Note also that if base is an FString, the indexes count 16-bit code units.
-
copy
public static SimpleVector copy(SimpleVector base, int start, int end, boolean writable)
-
copy
public static SimpleVector copy(List base, Range.IntRange range, boolean writable)
-
writeUInt
public static void writeUInt(int value, Consumer out)
-
writeULong
public static void writeULong(long value, Consumer out)
-
-