Re: How do I set up CollapsableHashtable to take parameters?
Joshua Cranmer wrote:
I don't use NetBeans myself (vim + command-line for me!), but there
should be a tool in there to clear the compiled code directory...
"Clean project".
phillip.s.powell@gmail.com wrote:
[code]
/*
* CollapsableHashtable.java
It is usually better for word parts in your identifiers to match the normal
human-language spelling, in this case "collapsible", so that future
maintainers won't get the class name wrong because they know how to spell.
Why did you extend Hashtable and use Enumeration? Do you need synchronized
methods? That is the only reason to prefer Hashtable to HashMap, and there is
no reason to prefer Enumeration to Iterator.
Even with synchronization requirements, it's often better to use HashMap and
synchronize with explicit code.
Besides the "synchronized" keyword, there is
<http://java.sun.com/javase/6/docs/api/java/util/Collections.html#synchronizedMap(java.util.Map)>
phillip.s.powell@gmail.com wrote:
public class CollapsableHashtable<K, V> extends Hashtable<K, V> {
public void removeAll() {
Tom Hawtin <use...@tackline.plus.com> wrote:
clear() would make more sense. Only it's there already...
phillip.s.powell@gmail.com wrote:
Not to me, I understand removeAll() more, but I'll keep that in mind.
That's just how my brain works
Even though clear() is already in the class through inheritance and
removeAll() is completely redundant?
<http://java.sun.com/javase/6/docs/api/java/util/Map.html#clear()>
Why write a method to do what the class already has a method to do?
-- Lew