1.

Which of these methods can convert an object into a List?(a) SetList()(b) ConvertList()(c) singletonList()(d) CopyList()The question was posed to me in an online interview.Asked question is from Collection Algorithms in section java.util – The Collections Framework of Java

Answer»

The CORRECT OPTION is (c) singletonList()

Explanation: singletonList() returns the object as an immutable LIST. This is an EASY way to convert a single object into a list. This was added by Java 2.0.



Discussion

No Comment Found

Related InterviewSolutions