Converting from HashSet to String[]

前端 未结 3 1504
清歌不尽
清歌不尽 2021-02-02 06:59

What\'s the best way to convert HashSet to String[]?

3条回答
  •  谎友^
    谎友^ (楼主)
    2021-02-02 07:27

    The JB Nizet's answer is correct. In Java 15, the better answer is:

    set.toArray(new String[0]); 
    

提交回复
热议问题