• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

singleton method in collections class

 
Ranch Hand
Posts: 689
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what sake the Collections class is meant for and what is the actual use of Singleton method ?
where it is used?
advantages?


thanks in advance
 
author & internet detective
Posts: 39343
755
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Saikrishna,
The Collections class provides utility methods for dealing with different types of Collections (Lists, Maps and Sets.)

The singleton method gives you a set with one object. (there are also list and map versions of this method.) Since the set is immutable (cannot be changed), Java is free to give you the exact same set if you later make the same method call.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!