Re: io: how many imgs in 'images' folder?



Eric Sosman wrote:
list() and listFiles() return arrays. You could use
them to populate a Vector or an ArrayList or whatever else
you like, if you think it would be fun.

ArrayList is probably a better choice than the hoary Vector class for a java.util.List implementation. You can always add synchronization to it using java.util.Collections.synchronized...() methods. Set might also be a suitable interface, since you likely will not need to list the same file twice in the collection.

Hash table?

java.util.HashMap is probably the better choice for a hash table (i.e., java.util.Map) implementation compared to java.util.Hashtable, with the same considerations as ArrayList vs. Vector.

-- Lew
.



Relevant Pages