Class GapLists
- java.lang.Object
-
- org.magicwerk.brownies.collections.helper.GapLists
-
public class GapLists extends java.lang.ObjectHelper class offering various functionality:
- create wrapper list objects wrapping primitive GapLists
- methods interacting with CharSequence, Reader, InputStream
- add methods explaining reason if fails with DuplicateKeyException
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classGapLists.ImplClassGapLists.Implmakes protected members ofGapListsImpllocally accessibleprotected static classGapLists.PrimitiveImplClassGapLists.PrimitiveImplmakes protected members ofGapListsPrimitiveImpllocally accessible
-
Constructor Summary
Constructors Constructor Description GapLists()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidadd(java.lang.CharSequence str, org.magicwerk.brownies.collections.primitive.CharGapList list, int start, int end)Add specified number of chars from CharSequence into CharGapList.static <E,EE extends E,K>
booleanaddAllExplained(Key1Collection<E,K> list, java.util.Collection<EE> adds)Implementation ofKeyCollectionImpl.addAll(java.util.Collection<? extends E>)which adds an explanatory exception message why adding failed with aDuplicateKeyException.static <E,EE extends E,K>
booleanaddAllExplained(Key1List<E,K> list, java.util.Collection<EE> adds)Implementation ofIList.addAll(org.magicwerk.brownies.collections.IList<? extends E>)which adds an explanatory exception message why adding failed with aDuplicateKeyException.static <E,EE extends E,K1,K2>
booleanaddAllExplained(Key2Collection<E,K1,K2> list, java.util.Collection<EE> adds)Implementation ofKeyCollectionImpl.addAll(java.util.Collection<? extends E>)which adds an explanatory exception message why adding failed with aDuplicateKeyException.static <E,EE extends E,K1,K2>
booleanaddAllExplained(Key2List<E,K1,K2> list, java.util.Collection<EE> adds)Implementation ofIList.addAll(org.magicwerk.brownies.collections.IList<? extends E>)which adds an explanatory exception message why adding failed with aDuplicateKeyException.static <E,EE extends E,K>
booleanaddExplained(Key1Collection<E,K> list, EE add)Implementation ofKeyCollectionImpl.add(E)which adds an explanatory exception message why adding failed with aDuplicateKeyException.static <E,EE extends E,K>
booleanaddExplained(Key1List<E,K> list, EE add)Implementation ofKeyListImpl.add(E)which adds an explanatory exception message why adding failed with aDuplicateKeyException.static <E,EE extends E,K1,K2>
booleanaddExplained(Key2Collection<E,K1,K2> list, EE add)Implementation ofKeyCollectionImpl.add(E)which adds an explanatory exception message why adding failed with aDuplicateKeyException.static <E,EE extends E,K1,K2>
booleanaddExplained(Key2List<E,K1,K2> list, EE add)Implementation ofKeyListImpl.add(E)which adds an explanatory exception message why adding failed with aDuplicateKeyException.static IList<?>createWrapperList(java.lang.Class<?> type)Create a GapList wrapping a primitive GapList, e.g. an IntObjGapList wrapping an IntGapList.static IList<?>createWrapperList(java.lang.Class<?> type, int capacity)Create a GapList wrapping a primitive GapList, e.g. an IntObjGapList wrapping an IntGapList.static intread(java.io.InputStream istream, org.magicwerk.brownies.collections.primitive.ByteGapList list, int len)Read specified number of bytes from InputStream into ByteGapList.static intread(java.io.Reader reader, org.magicwerk.brownies.collections.primitive.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.static voidwrite(java.io.OutputStream ostream, org.magicwerk.brownies.collections.primitive.ByteGapList list, int off, int len)Write specified number of bytes from ByteGapList into OutputStream.static voidwrite(java.io.Writer writer, org.magicwerk.brownies.collections.primitive.CharGapList list, int off, int len)Write specified number of chars from CharGapList into Writer.
-
-
-
Method Detail
-
addAllExplained
public static <E,EE extends E,K> boolean addAllExplained(Key1Collection<E,K> list, java.util.Collection<EE> adds)
Implementation ofKeyCollectionImpl.addAll(java.util.Collection<? extends E>)which adds an explanatory exception message why adding failed with aDuplicateKeyException.
-
addAllExplained
public static <E,EE extends E,K1,K2> boolean addAllExplained(Key2Collection<E,K1,K2> list, java.util.Collection<EE> adds)
Implementation ofKeyCollectionImpl.addAll(java.util.Collection<? extends E>)which adds an explanatory exception message why adding failed with aDuplicateKeyException.
-
addAllExplained
public static <E,EE extends E,K> boolean addAllExplained(Key1List<E,K> list, java.util.Collection<EE> adds)
Implementation ofIList.addAll(org.magicwerk.brownies.collections.IList<? extends E>)which adds an explanatory exception message why adding failed with aDuplicateKeyException.
-
addAllExplained
public static <E,EE extends E,K1,K2> boolean addAllExplained(Key2List<E,K1,K2> list, java.util.Collection<EE> adds)
Implementation ofIList.addAll(org.magicwerk.brownies.collections.IList<? extends E>)which adds an explanatory exception message why adding failed with aDuplicateKeyException.
-
addExplained
public static <E,EE extends E,K> boolean addExplained(Key1Collection<E,K> list, EE add)
Implementation ofKeyCollectionImpl.add(E)which adds an explanatory exception message why adding failed with aDuplicateKeyException.
-
addExplained
public static <E,EE extends E,K1,K2> boolean addExplained(Key2Collection<E,K1,K2> list, EE add)
Implementation ofKeyCollectionImpl.add(E)which adds an explanatory exception message why adding failed with aDuplicateKeyException.
-
addExplained
public static <E,EE extends E,K> boolean addExplained(Key1List<E,K> list, EE add)
Implementation ofKeyListImpl.add(E)which adds an explanatory exception message why adding failed with aDuplicateKeyException.
-
addExplained
public static <E,EE extends E,K1,K2> boolean addExplained(Key2List<E,K1,K2> list, EE add)
Implementation ofKeyListImpl.add(E)which adds an explanatory exception message why adding failed with aDuplicateKeyException.
-
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, org.magicwerk.brownies.collections.primitive.ByteGapList list, int len) throws java.io.IOExceptionRead 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
-
write
public static void write(java.io.OutputStream ostream, org.magicwerk.brownies.collections.primitive.ByteGapList list, int off, int len) throws java.io.IOExceptionWrite specified number of bytes from ByteGapList into OutputStream.- Parameters:
ostream- output stream (target)list- list (source)off- offset of first byte to writelen- number of bytes to write- Throws:
java.io.IOException
-
read
public static int read(java.io.Reader reader, org.magicwerk.brownies.collections.primitive.CharGapList list, int len) throws java.io.IOExceptionRead 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
-
write
public static void write(java.io.Writer writer, org.magicwerk.brownies.collections.primitive.CharGapList list, int off, int len) throws java.io.IOExceptionWrite specified number of chars from CharGapList into Writer.- Parameters:
writer- writer (target)list- list (source)off- offset of first char to writelen- number of chars to write- Throws:
java.io.IOException
-
add
public static void add(java.lang.CharSequence str, org.magicwerk.brownies.collections.primitive.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
-
-