Class InternalUtils


  • public class InternalUtils
    extends java.lang.Object
    Utilities for internal use only.
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  InternalUtils.Joiner
      A functional interface for joining Strings or Objects via Object.toString() using a pre-configured delimiter.
      static interface  InternalUtils.Splitter
      A functional interface for splitting Strings using a pre-configured regular expression.
    • Constructor Summary

      Constructors 
      Constructor Description
      InternalUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String commaJoin​(java.lang.String... strings)
      Join strings with ", " skipping nulls
      static <V> V getUninterruptibly​(java.util.concurrent.Future<V> future)
      Get a future's value uninterruptibly by temporarily ignoring InterruptedException, but making sure we re-set the thread's interrupt status, so higher-level code on the thread can handle the interruption properly.
      static InternalUtils.Joiner joiner​(java.lang.String delimiter)
      Return a lambda for joining Strings or Objects via Object.toString().
      static InternalUtils.Splitter splitter​(java.lang.String regex)
      Return a lambda for splitting a string into components
      • Methods inherited from class java.lang.Object

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

      • InternalUtils

        public InternalUtils()
    • Method Detail

      • joiner

        public static InternalUtils.Joiner joiner​(java.lang.String delimiter)
        Return a lambda for joining Strings or Objects via Object.toString().
        Parameters:
        delimiter - The delimiter used to join the String components
        Returns:
        A Joiner (lambda) instance
      • splitter

        public static InternalUtils.Splitter splitter​(java.lang.String regex)
        Return a lambda for splitting a string into components
        Parameters:
        regex - regular expression used to split components
        Returns:
        A Splitter (lambda) instance
      • commaJoin

        public static java.lang.String commaJoin​(java.lang.String... strings)
        Join strings with ", " skipping nulls
        Parameters:
        strings - varargs strings
        Returns:
        A joined string
      • getUninterruptibly

        public static <V> V getUninterruptibly​(java.util.concurrent.Future<V> future)
                                        throws java.util.concurrent.ExecutionException
        Get a future's value uninterruptibly by temporarily ignoring InterruptedException, but making sure we re-set the thread's interrupt status, so higher-level code on the thread can handle the interruption properly. Based upon the Guava implementation.
        Type Parameters:
        V - type of value
        Parameters:
        future - future with value to get
        Returns:
        the value
        Throws:
        java.util.concurrent.ExecutionException - if the computation through an exception