commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Neil O'Toole <>
Subject Re: [collections] submission: KeyValueRecord
Date Sun, 21 Sep 2003 02:15:09 GMT
> 'Record' confused me and made me think of databases. Is
> KeyValueHistory a better name?

Stephen, you're probably right. I had been bouncing back and forth
between 'Record' and 'History'... the data structure does *record*  a
kv-pair's *history*, but in fact only the most recent part (one state
transition 'record') of the history.

However, one would expect that a "KeyValueHistory" class should be able
to store the entire history of a key (as well as just a single value).
I hadn't initially needed this capability for my own purposes, but I
now see the usefulness. So,
 #getPreviousValue : Object

should probably be replaced with:

 #getAllValues : List

What do we think? In terms of design, either the constructors would get
very messy to use, or we need to add factory methods to distinguish

KeyValueHistory( Object key, Object value)
KeyValueHistory( Object key, List values)

Attached is an implementation that supports multiple previous values,
and provides static factory methods. Thoughts?

- Neil

View raw message