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
  • Constructor Details

    • GapLists

      public GapLists()
  • Method Details

    • createWrapperList

      public static IList<?> createWrapperList(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:
      IllegalArgumentException - if no primitive type is specified
    • createWrapperList

      public static IList<?> createWrapperList(Class<?> type, int capacity)
      Create a GapList wrapping a primitive GapList, e.g. an IntObjGapList wrapping an IntGapList.
      Parameters:
      type - primitive type for GapList
      capacity - initial capacity of created list
      Returns:
      created wrapping GapList
      Throws:
      IllegalArgumentException - if no primitive type is specified
    • toGapList

      public static <T> Collector<T,?,GapList<T>> toGapList()
      Return collector which collects the elements into a GapList.
      Returns:
      collector
    • toBigList

      public static <T> Collector<T,?,BigList<T>> toBigList()
      Return collector which collects the elements into a BigList.
      Returns:
      collector
    • read

      public static int read(InputStream istream, ByteGapList list, int len) throws 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:
      IOException
    • read

      public static int read(Reader reader, CharGapList list, int len) throws 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:
      IOException
    • add

      public static void add(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 CharSequence
      end - end position of characters to add in CharSequence