Is there a way to reset value inside Java Wrapper classes?
0 posts in topic
Flat View  Flat View

Posted By:   Albert_Scherer
Posted On:   Monday, October 22, 2001 08:34 AM

I have a large dataset from which I am calculating a running average of the last N datapoints (each of type double).

To do so, I'm using a LinkedList of Doubles. When the list reaches size N, I add a new entry to the end while dropping the oldest entry. While LinkedList method removeFirst() gives me a handle to the oldest entry, there doesn't appear to be a way to reuse the Double (i.e., to reset its value to that of the new data point).

It seems I either have to keep creating new Doubles or create my own wrapper-type Object that can support this. There is a lot of object creation and deletion going on that shouldn't be necessary. Any ideas?

About | Sitemap | Contact