Re: Question about ArrayList
How does a file's size relate to the capacity of an ArrayList? An ArrayList holds references to objects, not the full contents of an object.
Are you asking how to limit the number of objects that can be placed in an ArrayList based on the size of the objects?
What are you trying to do?
Re: Question about ArrayList
I have to create an ArrayList that can hold Song objects. Each Song object has an attribute, fileSize, that says, well, how big the file is. This ArrayList can hold any number of songs, but only as long as the total fileSize of those songs doesn't exceed a certain amount (To be set by me, say 15)
I'm not sure how to get that to work
Re: Question about ArrayList
One way would be to wrap the ArrayList in a class and have an add() method that would look at the filesize of items being added and control the number allowed based on total filesize so far.