java - general purpose Comparator for a TreeMap<Object, T>? -
i need treemap<object, hghandle>
objects neither comparable nor there common comparator<object>
.
the order in tree beeing relevant tree itself, there general comparator use tree?
info: want add trivial caching mechanism of database-like library, specialized bulk import. since memory-consuming task, prefer use tree-based map on hashmap, bulkimportcache becomes more space efficient , can grow , shrink required.
in order able use treemap
must able compare instances intend store in map
. might have comparator knows different types of object can stored in map , delegates type-specific comparators based on type. way slice it, must provide comparison mechanism , 1 not exist non-comparable
objects.
Comments
Post a Comment