Singleton List with singletonList()

What is singleton? With singleton class, you can create only one object. If another object is tried to create, the JVM throws UnsupportedOperationException. A Singleton class contains only one element. If tried to add a second element, the add() method throws UnsupportedOperationException. Singleton class limits the developer from instantiating more than one object. This idea …

Singleton List with singletonList() Read More »