Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.util.*;

public class Main {
    /**
     * Concatenate two String arrays.
     * @param array1 cannot be null.
     * @param array2 cannot be null.
     * @return result.
     */
    public static String[] concat(String[] array1, String[] array2) {
        ArrayList<String> result = new ArrayList<>();
        result.addAll(Arrays.asList(array1));
        result.addAll(Arrays.asList(array2));
        String[] array = new String[result.size()];
        result.toArray(array);
        return array;
    }
}