int
). To use a primitive type in an ArrayList, put it inside an object or use of the wrapper classes (eg, Integer, Double, Character, ...). The wrapper classes are immutable, so if you use, eg, Integer, you will not be able to change the integer value. In this case it may be more useful to define your own mutable class.
A java blog with a collection of examples and tutorials on Java and related technologies. (Under maintenance with continuous updates) Be in touch with java jazzle or k2java.blogspot.com.
Thursday, May 19, 2011
Object only limitation with collections
A possible disadvantage of ArrayList is that it holds only object types and not primitive types (eg,
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment