Java:: How to convert Arrays to List and Set (Collection) in Java
Converting a Java array into Set
or List
is a very common requirement in most Java projects. Java collections frameworks supports this in the following way.
Required Imports
|
|
Convert Array to List
|
|
Convert Array to Set
|
|
Note the use of generics
Difference between List and Set
List is an ordered sequence of elements whereas Set is a distinct list of elements which is unordered
Read more here:
Author: Deepu Mohan Puthrote
Link: https://deepumohan.com/tech/java-how-to-convert-arrays-into-set-and/
This work by Deepu Mohan Puthrote is licensed under a Creative Commons Attribution 4.0 International License