添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
String[] arr= new String[]{"A", "B", "C"}; 
List list = Arrays.asList(arr);     
Object[] result = list.toArray();   //使用toArray()方法
<dependency>
    <groupId>com.google.guava</groupId>
    <artifactId>guava</artifactId>
    <version>20.0</version>
</dependency>
byte[] bytes=Bytes.toArray(list);
String[] arr= new String[]{"A", "B", "C"};
List list = Arrays.asList(arr);
Set result = new HashSet(list);   //list转set

5、Set转数组

String[] arr= new String[]{"A", "B", "C"};
Set<String> set= new HashSet<>(Arrays.asList(arr));
Object[] result = set.toArray();        //使用toArray()方法

6、Set转List

String[] arr= new String[]{"A", "B", "C"};
Set<String> set= new HashSet(Arrays.asList(arr));
List<String> result = new ArrayList<>(set);