wood burning stoves 2.0*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes Collection Objects Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "Collection Objects" Watch "Collection Objects" New topic
Author

Collection Objects

Harini Mamidi
Greenhorn

Joined: Jan 05, 2004
Posts: 11
Are the collection objects immutable? like for example java.util.Vector...?
[ January 09, 2004: Message edited by: Harini Mamidi ]
Corey McGlone
Ranch Hand

Joined: Dec 20, 2001
Posts: 3271
Of course not. Notice that the collection objects have methods such as add and remove. These directly imply that the collections can be changed and, therefore, are not immutable.
Saying that something is immutable means simply that it CAN NOT be changed after it is created. That is certainly not the case with a collection.


SCJP Tipline, etc.
Harini Mamidi
Greenhorn

Joined: Jan 05, 2004
Posts: 11
Thank U for the reply
Yosi Hendarsjah
Ranch Hand

Joined: Oct 02, 2003
Posts: 164
You CAN create immutable collections. The easiest way is by using the class java.util.Collections. There are several static methods (the methods' names start with 'unmodifiable'). The harder way is to create your own class that implements Collection interface or to extend the existing collection classes.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Collection Objects
 
Similar Threads
islands of isolation(Garbage Collection)
Garbage collection
Sorting multiple colums
how many objects eligible for GC?
collection objects