Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

one question

 
Jack Nicholson
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I am having reqmt that
I am having method which is returning One ArrayList.
But I don't want anybody should be able to change/modify that ArrayList.
What to be do for that ?
Thanx in adv.
 
Don Kiddick
Ranch Hand
Posts: 580
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could try :

or

The latter returns a list that is backed by the original list, so if the original list changes the clients version will reflect that. The former returns a copy of the list and changes will not propogate.
did that help ?
D.
[ October 17, 2003: Message edited by: Don Kiddick ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic