I want to know how to connect two string arrays.

Asked 1 years ago, Updated 1 years ago, 119 views

    void f(String[] first, String[] second) {
        String[] both = ???
    }

If you look at the source, there are String parameters first and second, and I want to combine these two.

java array concatenation add

2022-09-22 12:29

1 Answers

I found a good way at Apache Commons Lang library. site

    String[] both = (String[])ArrayUtils.addAll(first, second);

You can use it like this.


2022-09-22 12:29

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.