File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes one question Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of RabbitMQ in Depth this week in the Open Source forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "one question" Watch "one question" New topic

one question

Jack Nicholson
Ranch Hand

Joined: Sep 07, 2002
Posts: 41
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.

Jack Nicholson
Don Kiddick
Ranch Hand

Joined: Dec 12, 2002
Posts: 580
You could try :


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 ?
[ October 17, 2003: Message edited by: Don Kiddick ]
I agree. Here's the link:
subject: one question