Message2940
> > From a cursory examining, it seems like PyMapCollection/Set
> > could be greatly simplified by extending AbstractSet rather
> > than implementing the whole interface on its own. Many of the
> > implemented methods could just go away.
>
> Not Really, the problem is that (Which is true in general)
> objects retrieved from the dictionary in java code must pass
> through __tojava__, and java object being passed to the
> dictionary must use Py.java2py which utilizes the plugable
> PyObjectAdapter system. Using AbstractSet would eliminate size()
> and isEmpty(), but I think that's about it. Allot of the code
> implements the obscure java.util.Map#entrySet method which will
> probably never get used, but I added it for completeness.
Since most of AbstractSet operates on the Iterator returned by its concrete implementation, and PyMapSet has to implement iterator, the methods on AbstractSet will go through that iterator. I've attached a new version of your patch that uses AbstractSet and passes your tests. It eliminates 9 methods: hashCode, equals, retainAll, removeAll, containsAll, add, addAll, toArray and isEmpty. Am I missing something? |
|
Date |
User |
Action |
Args |
2008-02-20 17:18:52 | admin | link | issue1817565 messages |
2008-02-20 17:18:52 | admin | create | |
|