Java implementation

Listing 3-1 shows a test driver for a TimeSeries class. The class is parameterized, the parameter being the object type of the event that is moving through time. In this program, that type is String.

An array of six strings is defined at line 11. These will be the events to be loaded into the series object that is instantiated at line 14. The loading is done by the load(), defined at lines 27-31 and invoked at line 15.

Java implementation

Listing 3-1. Test program for TimeSeries class

The contents of the series are loaded at line 15. Then at lines 17-21, the six key-value pairs are printed. Finally, at lines 23-24, we use the direct access capability ...

Get Java Data Analysis now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.