Add String to beginning of String array

前端 未结 9 1032
孤独总比滥情好
孤独总比滥情好 2021-01-01 09:44

Is it possible to add a string to beginning of String array without iterating the entire array.

9条回答
  •  耶瑟儿~
    2021-01-01 10:12

    If you're already using Guava you can use ObjectArrays::concat to do this:

    String[] args = ...;
    ObjectArrays.concat("prepended", args);
    

提交回复
热议问题