This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
You can use generics in your interface declaration:
Then use it like this:
[ January 04, 2007: Message edited by: Garrett Rowe ]
Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Joined: Jan 17, 2006
As a further thought, the compililer will still issue a warning any time you try to retrieve items from (or add items to ) the raw Collection. If you are just going to build the String by calling toString() on all the elements of the Collection, you can assume its a Collection of Objects:
Caveat: I believe this is correct, but I don't have a compiler handy. YMMV. [ January 04, 2007: Message edited by: Garrett Rowe ]
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
Joined: May 26, 2005
Excellent Garrett! I missed using implements StringBuilder<Integer>.