Class GapLists
- java.lang.Object
-
- org.magicwerk.brownies.collections.primitive.GapListPrimitives
-
- org.magicwerk.brownies.collections.helper.GapLists
-
public class GapLists extends GapListPrimitives
Helper class offering various functionality:
- create wrapper list objects wrapping primitive GapLists
- methods interacting with CharSequence, Reader, InputStream
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
GapLists.CollectorImpl<T,A,R>
-
Constructor Summary
Constructors Constructor Description GapLists()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static void
add(java.lang.CharSequence str, CharGapList list, int start, int end)
Add specified number of chars from CharSequence into CharGapList.static IList<?>
createWrapperList(java.lang.Class<?> type)
Create a GapList wrapping a primitive GapList, e.g.static IList<?>
createWrapperList(java.lang.Class<?> type, int capacity)
Create a GapList wrapping a primitive GapList, e.g.static int
read(java.io.InputStream istream, ByteGapList list, int len)
Read specified number of bytes from InputStream into ByteGapList.static int
read(java.io.Reader reader, CharGapList list, int len)
Read specified number of chars from Reader into CharGapList.static <T> java.util.stream.Collector<T,?,BigList<T>>
toBigList()
Return collector which collects the elements into aBigList
.static <T> java.util.stream.Collector<T,?,GapList<T>>
toGapList()
Return collector which collects the elements into aGapList
.-
Methods inherited from class org.magicwerk.brownies.collections.primitive.GapListPrimitives
write, write
-
-
-
-
Method Detail
-
createWrapperList
public static IList<?> createWrapperList(java.lang.Class<?> type)
Create a GapList wrapping a primitive GapList, e.g. an IntObjGapList wrapping an IntGapList.- Parameters:
type
- primitive type for GapList- Returns:
- created wrapping GapList
- Throws:
java.lang.IllegalArgumentException
- if no primitive type is specified
-
createWrapperList
public static IList<?> createWrapperList(java.lang.Class<?> type, int capacity)
Create a GapList wrapping a primitive GapList, e.g. an IntObjGapList wrapping an IntGapList.- Parameters:
type
- primitive type for GapListcapacity
- initial capacity of created list- Returns:
- created wrapping GapList
- Throws:
java.lang.IllegalArgumentException
- if no primitive type is specified
-
toGapList
public static <T> java.util.stream.Collector<T,?,GapList<T>> toGapList()
Return collector which collects the elements into aGapList
.- Returns:
- collector
-
toBigList
public static <T> java.util.stream.Collector<T,?,BigList<T>> toBigList()
Return collector which collects the elements into aBigList
.- Returns:
- collector
-
read
public static int read(java.io.InputStream istream, ByteGapList list, int len) throws java.io.IOException
Read specified number of bytes from InputStream into ByteGapList.- Parameters:
istream
- input stream (source)list
- list (target)len
- maximum number of bytes to read- Returns:
- number of bytes read into the buffer, -1 if end of stream has been reached
- Throws:
java.io.IOException
-
read
public static int read(java.io.Reader reader, CharGapList list, int len) throws java.io.IOException
Read specified number of chars from Reader into CharGapList.- Parameters:
reader
- reader (source)list
- list (target)len
- maximum number of bytes to read- Returns:
- number of bytes read into the buffer, -1 if end of stream has been reached
- Throws:
java.io.IOException
-
add
public static void add(java.lang.CharSequence str, CharGapList list, int start, int end)
Add specified number of chars from CharSequence into CharGapList.- Parameters:
str
- CharSequence (source)list
- list (target)start
- start position of characters to add in CharSequenceend
- end position of characters to add in CharSequence
-
-