//package com.nowjava;
/*
n o w j a v a . c o m 提供
*/
public class Main {
public static void main(String[] argv) throws Exception {
String[] array = new String[] { "1", "abc", "level", null,
"nowjava.com", "asdf 123" };
String str = "nowjava.com";
System.out.println(java.util.Arrays.toString(addStringToArray(
array, str)));
}
/**
* Append the given String to the given String array, returning a new array consisting of the input array
* contents plus the given String.
*
* @param array
* the array to append to (can be <code>null</code>)
* @param str
* the String to append
* @return the new array (never <code>null</code>)
*/
public static String[] addStringToArray(final String[] array,
final String str) {
/** 来 自 nowjava - 时代Java**/
// if (ObjectUtils.isEmpty(array)) {
if (array.length == 0)
return new String[] { str };
/**代码未完, 请加载全部代码(NowJava.com).**/
本文系作者在时代Java发表,未经许可,不得转载。如有侵权,请联系nowjava@qq.com删除。