Class ListUtilitiesKt

    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      final static Boolean endsWith(List<String> $self, String string) Check whether any entry in this list ends with the given string.
      final static Boolean startsWith(List<String> $self, String string) Check whether any entry in this list starts with the given string.
      final static <A extends Any, B extends Any> List<B> parallelMap(List<A> $self, CoroutineContext context, SuspendFunction1<A, B> function) Compute all elements in the list in parallel and continue when every element was computed.
      final static <T extends Any> Unit addMultiple(List<T> $self, T entries) Add multiple elements to a list in one go.
      final static <T extends Any> List<T> concatenate(List<T> lists) Flatten several lists into one, preserving order.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • endsWith

         final static Boolean endsWith(List<String> $self, String string)

        Check whether any entry in this list ends with the given string.

        Parameters:
        string - The text to check entries with.
      • startsWith

         final static Boolean startsWith(List<String> $self, String string)

        Check whether any entry in this list starts with the given string.

        Parameters:
        string - The text to check entries with.
      • parallelMap

         final static <A extends Any, B extends Any> List<B> parallelMap(List<A> $self, CoroutineContext context, SuspendFunction1<A, B> function)

        Compute all elements in the list in parallel and continue when every element was computed.

        Defaults to Dispatchers.Default, the shared pool sized to the available processors, so elements genuinely run in parallel and no thread outlives the call. Do not default this to newSingleThreadContext: that factory hands out a dedicated thread its creator has to close(), which a defaulted parameter can never do, so every invocation stranded one thread for the life of the JVM — and confined the whole list to a single thread besides. Pinned by ListUtilitiesTest.parallelMapDoesNotLeakAThreadPerInvocation and ListUtilitiesTest.parallelMapRunsElementsOnMoreThanOneThread.

      • addMultiple

         final static <T extends Any> Unit addMultiple(List<T> $self, T entries)

        Add multiple elements to a list in one go.

      • concatenate

         final static <T extends Any> List<T> concatenate(List<T> lists)

        Flatten several lists into one, preserving order. Top-level so callers need no utilities instance.