ArrayUtil

public class ArrayUtil
extends Object

java.lang.Object
   ↳ com.android.tradefed.util.ArrayUtil


Utility methods for arrays

Summary

Public methods

static String[] buildArray(String... arrays)

Build an array from the provided contents.

static String join(String sep, Object... pieces)

Turns a sequence of objects into a string, delimited by sep.

static <T> list(T... inputAry)

Convert a varargs list/array to an ERROR(/List).

Public methods

buildArray

public static String[] buildArray (String... arrays)

Build an array from the provided contents.

The resulting array will be the concatenation of arrays input arrays, in their original order.

Parameters
arrays String: the arrays to concatenate

Returns
String[] the newly constructed array

join

public static String join (String sep, 
                Object... pieces)

Turns a sequence of objects into a string, delimited by sep. If a single Collection is passed, it is assumed that the elements of that Collection are to be joined. Otherwise, wraps the passed Object(s) in a ERROR(/List) and joins the generated list.

Parameters
sep String: the string separator to delimit the different output segments.

pieces Object: A ERROR(/Collection) or a varargs Array of objects.

Returns
String

list

public static  list (T... inputAry)

Convert a varargs list/array to an ERROR(/List). This is useful for building instances of ERROR(/List) by hand. Note that this differs from Arrays.asList(T) in that the returned array is mutable.

Parameters
inputAry T: an array, or a varargs list

Returns
a ERROR(/List) instance with the identical contents