TickerSymbol has bad hashCode function
Closed this issue · 2 comments
GoogleCodeExporter commented
What steps will reproduce the problem?
1. try filtering out duplicate TickerSymbol objects like you do in
MarketNeuralDataSet:
final Set<TickerSymbol> set = new HashSet<TickerSymbol>();
for (final TemporalDataDescription desc : getDescriptions()) {
final MarketDataDescription mdesc = (MarketDataDescription) desc;
set.add(mdesc.getTicker());
}
I use the same TickerSymbol (same symbol and exchange) multiple times and it
adds this to the Set every time (Sets aren't supposed to accept duplicates)
I replaced TickerSymbol.hashCode() with this and it works:
/**
* {@inheritDoc}
*/
@Override
public int hashCode() {
return safeHashCode(this.symbol)
+ safeHashCode(this.exchange);
}
public static <T> int safeHashCode(T o) {
return o == null ? 0 : o.hashCode();
}
How do I go about getting commit access to the repository? I often find bugs...
Original issue reported on code.google.com by dmi...@gmail.com
on 26 Aug 2010 at 3:52
GoogleCodeExporter commented
Thanks for the fix. Send me an email(through our support page), and I can give
you contribution access.
http://www.heatonresearch.com/contact
Original comment by JeffHeat...@gmail.com
on 9 Sep 2010 at 8:44
GoogleCodeExporter commented
Original comment by dmi...@gmail.com
on 16 Sep 2010 at 4:17
- Changed state: Fixed