// more add statements here..
((String) lst.get(j)).toUpperCase()
lst.get(j).toString().toUpperCase();
casting or toString() ?? which one is better to use.
toString and (String) do quite different things.
You would rarely use (String) today. All it can do is reassure Java
that some Object is indeed ALREADY a String. It cannot change anything
else into a String. It is not like (int) that can cause a
transformation. Unfortunately, the (cast) syntax has two completely
different meanings, conversion and reassurance. Today you use
generics instead of most reassurance casting. You no longer need
(String).
toString on the other hand in a worker method that does its best to
display the Object in some reasonable way to make sense to humans.
String.toString just returns the String. All it does is waste time.
So the answer to you question is NEITHER. Use generics. If they
frighten you, use (String). You are reassuring, no converting.
See
http://mindprod.com/jgloss/generics.html