An immutable List (also referred to as an unmodifiable List) cannot have it's contents changed. The methods to add or remove items will throw exceptions if you tr to alter the contents.
A singleton List contains only that item and cannot be altered.
Ya I understood the terms.thanks I came across this code.But why do we create a list with a single object. Can you say what is the advantage in using collections.singletonlist() ?
If you want an empty list, you can use Collections.EMPTY_LIST or emptyList(). If you want an unmodifiable List containing a single item, compare Collections.singletonlist("My Object") to the code doing the same.