Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which data structure is sensible for time series data in Java?

I'm new to Java, so I'm not sure which choice of data structure would be good here. I'll store accelerometer, gyroscope and magnetometer data (9 values) in a list, to be used later for smoothing, display and some signal processing.

My idea is to create an object MyObject that has ten members: time stamp and the nine orientation/motion values, all of them floats. I'll then store the data in an ArrayList<MyObject>. Is it a good idea or have I overlooked something?

The list will hold at most 100k values.

like image 276
Andreas Avatar asked Jun 07 '13 20:06

Andreas


1 Answers

Use TreeMap for a start to improve lookup performance.

TreeMap

Note (in docs):

This implementation provides guaranteed log(n) time cost for the containsKey, get, put and remove operations.

like image 93
Excalibur2000 Avatar answered Oct 06 '22 00:10

Excalibur2000