why grant an outmost interface yield hashcode/equals hashmap?


with treemap it's excusable yield tradition comparator, so vital semantics presumption comparable objects total map. hashmaps however can't tranquil manner; functions providing crush values equivalence checks can't 'side-loaded'.



i think both easy useful settlement an interface retrofit hashmap (or new class)? something this, solely improved names:



  interface hasharator<t> {
int alternativehashcode(t t);
boolean alternativeequals(t t1, t t2);
}

category hasharatormap<k, v> {
hasharatormap(hasharator<? super k> hasharator) { ... }
}

category hasharatorset<t> {
hasharatorset(hasharator<? super t> hasharator) { ... }
}


the problem gets excusable solution:



 new hasharatormap(string.case_insensitive_equality);


would doable, any component problems approach?



is proceed used any existent (non-jre) libs? (tried google, luck.)



edit: good workaround presented hazzen, nonetheless i'm fearful workaround i'm perplexing avoid... ;)



edit: altered due longer plead "comparator"; i think bit confusing.



edit: supposed answer union performance; adore some-more specific answer!



edit: there an implementation; supposed answer below.



edit: rephrased initial visualisation infer some-more clearly it's side-loading i'm after (and ordering; organization does go hashmap).



Comments

Popular posts from this blog

list macos calm editors formula editors

how hibernate @any-related annotations?

why does floated <input> control floated component slip over too distant right ie7, nonetheless firefox?