I am collecting data every minute up to nine or more elements (double and strings, possibly) for 24 hours. I was planning on storing them in an array and then push out the oldest element and realized that array can be of only one type. This way I can access specific time elements as needed. The program runs constantly collecting data, everything will be stored in a database ultimately but every few minutes data will be pushed to another site. I thought having the extra database access would be painful for performance so I was looking at an in memory structure.
Here is my sample code which I have not completed yet but thought since I am still new to Java there might be some better approach instead of an array, maybe a stack, a queue, etc.
In this case, I am storing up to 10 minutes of data just to work through the process.
Lists have the advantage of being growable, but... I think you're overestimating the performance hit of a database. That said, I'd collect data and occasionally start up a thread to do the "send it somewhere else" bit, eliminating large memory usage, database access, data collection misses due to communication issues, etc. If the data needs to be reliably persisted, however, you'll want to either shove it into a file or DB.