David Jencks wrote:


Why isn't it V insert(K, V)? AvlTreeMap doesn't appear to extend anything.... I don't see how returning the supplied key is very useful whereas returning the previous value if any is quite useful.

that makes sense, cause its a map, but one issue is this map supports duplicates
also, in this case the 'value' defined as V will not be of the same type as the 
one given during instantiation.
e.x given the declaration as AvlTreeMap<Integer,Integer> treeMap = new 
AvlTreeMap<Integer,Integer>()
in case duplicates are enabled the 'value' will hold a AvlTree type.

This can easily lead to CCE without some extra checks.

Alex, wdyt? is there any use case that requires the value, if yes, should the 
same semantic be applied to remove(K,V) also?

thanks David

Kiran Ayyagari

Reply via email to