Here you can find the source of concatTwoStringArray(String[] first, String[] second)
Parameter | Description |
---|---|
first | first String[] |
second | second String[] |
static public String[] concatTwoStringArray(String[] first, String[] second)
//package com.java2s; /******************************************************************************* * Copyright (c) 2014, 2016 IBM Corporation. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html *******************************************************************************/ import java.util.ArrayList; import java.util.Collections; import java.util.List; public class Main { /**// w w w.j a v a2 s .co m * Merge Two String arrays together into one. * @param first first String[] * @param second second String[] * @return Merged String[] */ static public String[] concatTwoStringArray(String[] first, String[] second) { List<String> both = new ArrayList<String>(first.length + second.length); Collections.addAll(both, first); Collections.addAll(both, second); return both.toArray(new String[both.size()]); } }