I dont want to pass an ArrayList from one class to another as i dont want the client to explicitly type cast the objects present in the ArrayList that is the client should not be bothered to know that what type of object does the ArrayList contains. What are the other options available that is what can i pass instead of ArrayList?
William Brogden
Author and all-around good cowpoke
Rancher
Joined: Mar 22, 2000
Posts: 12266
1
posted
0
I'm not sure I understand what you want, but I find it convenient to use the toArray( exampleArray ) method. For instance, this fragment reads lines to an ArrayList but returns a String[]
If you hand toArray an array of the right size, it fills in the elements, casting to the array type. Bill
Well Tony's already given links to the nitty gritty details; excellent. There's also a good overview of 1.5 changes here. and note that JDK 1.5 beta is out now, so you can try out generics yourself. (Along with lots of other changes.)
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to
run our stuff on 16 servers instead of 3.