Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Enumeration or Array as return type

 
Stephen Suen
Ranch Hand
Posts: 34
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, all,

When a method need return an object list as result, I notice that two implementations exist in JDK. Some take java.util.Enumeration as return type (java.sql.DriverManager.getDrivers), and some take arrays (java.awt.Container.getComponents) instead. Of cource, other choices also there, for example, java.util.Iterator, etc. But, here, my question is on Enumeration and array: I wonder whether there's any resonable consideration when determining which is the appropriate return type?

Any advice will be appreciated.

Stephen Suen
 
Dirk Schreckmann
Sheriff
Posts: 7023
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Moving this to the Intermediate forum...
[ July 08, 2004: Message edited by: Dirk Schreckmann ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic