Hi,
I am using my office-mate's class. My class is subclass of hers. Her
class has a private HashMap.
public abstract Parent //her class
{
private Map<String, Object> _map;
public Parent()
{
_map = new HashMap(10); //only with size of 10 !!!
}
public void insertState(String tag, double value) {
_map.put(tag, new Double(value));
}
...
}
public Sub extends Parent //my class
{
public Sub()
{
insertState("ATag", 1.2);
insertState("BTag", 1.6);
insertState("CTag", 1.8);
insertState("DTag", 2.5);
... //I inserted 15 times with different tags and values. My
program works correctly. Every value can be successfully retrieved.
}
...
}
How to explain why I can insert more than 10 tags-values into map and my
program works correctly? Is this possible? Or my program actually does
Not run correctly, just my testing is not rigorous enough?
Thank you.
Daniel Dyer - 04 Jun 2007 14:27 GMT
> Hi,
>
> I am using my office-mate's class. My class is subclass of hers. Her
> class has a private HashMap.
...
> How to explain why I can insert more than 10 tags-values into map and my
> program works correctly? Is this possible? Or my program actually does
> Not run correctly, just my testing is not rigorous enough?
RTFM: http://java.sun.com/j2se/1.5.0/docs/api/java/util/HashMap.html
Dan.

Signature
Daniel Dyer
http://www.uncommons.org
Twisted - 04 Jun 2007 14:41 GMT
To answer the question in the subject, yes.
Note that my reply is politer than the other one.
Lew - 04 Jun 2007 15:32 GMT
> To answer the question in the subject, yes.
>
> Note that my reply is politer than the other one.
Daniel's answer was useful, though - he provided the link to explain in more
detail in case the OP needed more depth. Programming knowledge is ideally
like the proverbial tip of the iceberg - you only show the top 10%. Daniel
was helping the OP know where to find the other 90% that makes that possible.

Signature
Lew
www - 04 Jun 2007 15:39 GMT
>> To answer the question in the subject, yes.
>>
[quoted text clipped - 5 lines]
> 10%. Daniel was helping the OP know where to find the other 90% that
> makes that possible.
It is strange. I don't see any posting by Daniel. I only see Twisted and
Lew's. So I have no idea what Lew and Twisted are talking about.
Lew - 04 Jun 2007 15:57 GMT
> It is strange. I don't see any posting by Daniel. I only see Twisted and
> Lew's. So I have no idea what Lew and Twisted are talking about.
Here ya go:
>>> Hi,
>>>
[quoted text clipped - 13 lines]
>> --Daniel Dyer
>> http://www.uncommons.org
Daniel Dyer - 04 Jun 2007 18:54 GMT
> To answer the question in the subject, yes.
>
> Note that my reply is politer than the other one.
Indeed, but not as helpful ;)
I like to interpret RTFM as "Read The Fine Manual", rather than the usual,
coarser interpretation. No offence intended to the OP, but it's probably
best to check the docs first (or even ask the co-worker who's code you
were having problems with).
Dan.

Signature
Daniel Dyer
http//www.uncommons.org