Class ArrayJoiner


  • public final class ArrayJoiner
    extends java.lang.Object
    A Joiner utility that works for primitive arrays which Guava's Joiner can't deal with.
    Author:
    thomas.jungblut
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.lang.String join​(byte[] array)
      Joins the given array with the separator and returns the resulting string.
      java.lang.String join​(char[] array)
      Joins the given array with the separator and returns the resulting string.
      java.lang.String join​(double[] array)
      Joins the given array with the separator and returns the resulting string.
      java.lang.String join​(float[] array)
      Joins the given array with the separator and returns the resulting string.
      java.lang.String join​(int[] array)
      Joins the given array with the separator and returns the resulting string.
      java.lang.String join​(long[] array)
      Joins the given array with the separator and returns the resulting string.
      java.lang.String join​(short[] array)
      Joins the given array with the separator and returns the resulting string.
      static ArrayJoiner on​(char separator)  
      static ArrayJoiner on​(java.lang.String separator)  
      • Methods inherited from class java.lang.Object

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

      • join

        public java.lang.String join​(byte[] array)
        Joins the given array with the separator and returns the resulting string. So an array of [1,2,3,4] turns into "1,2,3,4".
        Parameters:
        array - a not null array of byte.
        Returns:
        a string containing the results.
      • join

        public java.lang.String join​(short[] array)
        Joins the given array with the separator and returns the resulting string. So an array of [1,2,3,4] turns into "1,2,3,4".
        Parameters:
        array - a not null array of short.
        Returns:
        a string containing the results.
      • join

        public java.lang.String join​(int[] array)
        Joins the given array with the separator and returns the resulting string. So an array of [1,2,3,4] turns into "1,2,3,4".
        Parameters:
        array - a not null array of int.
        Returns:
        a string containing the results.
      • join

        public java.lang.String join​(long[] array)
        Joins the given array with the separator and returns the resulting string. So an array of [1,2,3,4] turns into "1,2,3,4".
        Parameters:
        array - a not null array of long.
        Returns:
        a string containing the results.
      • join

        public java.lang.String join​(float[] array)
        Joins the given array with the separator and returns the resulting string. So an array of [1,2,3,4] turns into "1,2,3,4".
        Parameters:
        array - a not null array of float.
        Returns:
        a string containing the results.
      • join

        public java.lang.String join​(double[] array)
        Joins the given array with the separator and returns the resulting string. So an array of [1,2,3,4] turns into "1,2,3,4".
        Parameters:
        array - a not null array of double.
        Returns:
        a string containing the results.
      • join

        public java.lang.String join​(char[] array)
        Joins the given array with the separator and returns the resulting string. So an array of [1,2,3,4] turns into "1,2,3,4".
        Parameters:
        array - a not null array of char.
        Returns:
        a string containing the results.
      • on

        public static ArrayJoiner on​(char separator)
        Returns:
        a new joiner on that separator.
      • on

        public static ArrayJoiner on​(java.lang.String separator)
        Returns:
        a new joiner on that separator.