I want to know how to connect two string arrays.

Asked 2 years ago, Updated 2 years ago, 133 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.