Answers for "convert list to set java"

7

java list to set

Set<Foo> foo = new HashSet<Foo>(myList);
Posted by: Guest on February-26-2020
2

convert set to list java

public void givenUsingCoreJava_whenSetConvertedToList_thenCorrect() {
   Set<Integer> sourceSet = Sets.newHashSet(0, 1, 2, 3, 4, 5);
   List<Integer> targetList = new ArrayList<>(sourceSet);
}
Posted by: Guest on December-09-2020
3

convert array to list java

/*
Get the Array to be converted.
Create the List by passing the Array as parameter in the constructor of the List with the help of Arrays. asList() method.
Return the formed List.
*/

String[] namedata = { "ram", "shyam", "balram" }; 

List<String> list = Arrays.asList(namedata);
Posted by: Guest on May-07-2020

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language