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> list(T... inputAry)

Convert a varargs list/array to an List.

Public methods

buildArray

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

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 List and joins the generated list.

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

pieces Object: A Collection or a varargs Array of objects.

Returns
String

list

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

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

Parameters
inputAry T: an array, or a varargs list

Returns
List<T> a List instance with the identical contents