org.omnaest.utils.structure.array
Class ArrayUtils

java.lang.Object
  extended by org.omnaest.utils.structure.array.ArrayUtils

public class ArrayUtils
extends Object

Helper methods for arrays.

Author:
Omnaest
See Also:
CollectionUtils

Constructor Summary
ArrayUtils()
           
 
Method Summary
static
<TO,FROM> TO[]
convertArray(FROM[] arrayFrom, TO[] arrayTo, CollectionUtils.ElementConverter<FROM,TO> elementConverter)
          Converts a given array into a new array with a new element type.
static
<TO,FROM> TO[]
convertArrayExcludingNullElements(FROM[] arrayFrom, TO[] arrayTo, CollectionUtils.ElementConverter<FROM,TO> elementConverter)
          Converts a given array into a new list with a new element type, whereby all elements which convert to null will be excluded in the target list.
static String[] trimStringArrayTokens(String[] stringArray)
          Returns a new array with all tokens of the given string array being trimmed
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ArrayUtils

public ArrayUtils()
Method Detail

convertArray

public static <TO,FROM> TO[] convertArray(FROM[] arrayFrom,
                                          TO[] arrayTo,
                                          CollectionUtils.ElementConverter<FROM,TO> elementConverter)
Converts a given array into a new array with a new element type.

Parameters:
arrayFrom -
arrayTo - : instance of the array later returned. Use the return value to set this list. The array will not be necessarily changed only by the call as parameter.
elementConverter -
Returns:

convertArrayExcludingNullElements

public static <TO,FROM> TO[] convertArrayExcludingNullElements(FROM[] arrayFrom,
                                                               TO[] arrayTo,
                                                               CollectionUtils.ElementConverter<FROM,TO> elementConverter)
Converts a given array into a new list with a new element type, whereby all elements which convert to null will be excluded in the target list.

Parameters:
listFrom -
elementConverter -
Returns:

trimStringArrayTokens

public static String[] trimStringArrayTokens(String[] stringArray)
Returns a new array with all tokens of the given string array being trimmed

Parameters:
stringArray -
Returns:
new array with all trimmed tokens


Copyright © 2011. All Rights Reserved.