Can you change the array to Set more easily?

Asked 1 years ago, Updated 1 years ago, 121 views

I want to change the array to Set in Java. java.util.Arrays.asList(Object[] a); I can use asList, but I want to find a cleaner way.

java collections array set

2022-09-21 18:23

1 Answers

Set<T> mySet = new HashSet<T>(Arrays.asList(someArray)); How about this?


2022-09-21 18:23

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.