touche :)
On Mon, Aug 10, 2009 at 3:30 PM, Noel Grandin <[email protected]> wrote:
> sample setComparator implementation:
>
> private final TreeMap map;
>
> public void setComparator(Comparator comp) {
> TreeMap newMap = new TreeMap(comp);
> newMap.addAll(this.map);
> this.map = newMap;
> }
>
>
> On Mon, Aug 10, 2009 at 20:08, Todd Volkert<[email protected]> wrote:
> > I skimmed this thread, because I didn't see anyone point out that right
> now,
> > setComparator() on HashMap throws, because there's no way to pass that
> > through the the JDK's collections. So right now, HashMap is incomplete
> out
> > of necessity until it has its own implementation.
> > -T
> >
> > On Mon, Aug 10, 2009 at 8:37 AM, Greg Brown <[email protected]> wrote:
> >
> >> Map fires events in put() and delete(), which is a small amount of
> >>> extra code and I don't see how inlining will make that faster.
> >>> Sorting just means using TreeMap instead of HashMap.
> >>>
> >>
> >> To me, that sounds a lot uglier than simply implementing the hash map
> >> internally. It's also a lot heavier. Overall, not very elegant.
> >>
> >> And the iterations are basically the same, expect that Pivot has a
> >>> Sequence API, which is a thin wrapper over Collection.
> >>>
> >>
> >> Sequence is used for list-type data. Dictionary is used for maps. A Map
> in
> >> Pivot is a Dictionary that also implements Collection.
> >>
> >> Pivot maps iterate over their keys. JDK maps don't even implement
> >> java.util.Collection and require calls to keySet(), entrySet(), or
> values()
> >> to iterate.
> >>
> >>
> >
>