Android examples for java.lang:array
Add Element to Array
//package com.book2s; import java.util.ArrayList; import java.util.List; public class Main { public static <T> T[] mergeArray(T t, T[] arrays) { List<T> newArrays = new ArrayList<T>(); if (t != null) { newArrays.add(t);/*from w w w . ja v a 2s . co m*/ } if (arrays != null) { for (T e : arrays) { newArrays.add(e); } } return (T[]) newArrays.toArray(); } }