in Education by (1.8m points)
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

Select the correct answer from above options

JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by (1.8m points)
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.

Related questions

0 votes
asked Oct 24, 2021 in Education by JackTerrance (1.8m points)
...