Can you change the array to Set more easily?

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