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: