Correct Option: B. singletonList() returns the object as an immutable List. This is an easy way to convert a single object into a list.
Read moreHow do you add an object to a list in Java?
You insert elements (objects) into a Java List using its add() method . Here is an example of adding elements to a Java List using the add() method: List<String> listA = new ArrayList<>(); listA. add(“element 1”); listA.
Read moreWhich can convert an object to list in Java?
toList()) can be used to collect Stream elements into a list. We can leverage this to convert object to a list. //Similarly, you can change the method in the map to convert to the datatype you need.24 Eki 2021
Read moreHow do I cast an object to a list?
Solution 1
Read more