updating an vigilant within set


let's contend i have form application:



public category {
open int id;
open b b;

open boolean equals(object another) { relapse this.id == ((a)another).id; }
open int hashcode() { relapse 31 * id; //nice primary array }
}


and set<a> structure. now, i have an vigilant form a wish following:




  • if a within set, transform the domain b review object.

  • else, supplement set.



so checking there easy adequate (contains), adding set easy too. doubt this: i hoop transform vigilant within? interface set doesn't have get method, best i cruise mislay vigilant set supplement mine. another, even worse, choice camber set an iterator try locate object.



i'll gladly take improved suggestions... includes fit information structures.



yuval =8-)



edit: conclude answering... unfortunately i can't 'accept' best answers here, those advise controlling map, since changing form collection radically purpose wholly small impassioned (this collection already mapped by hibernate...)



Comments

Popular posts from this blog

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

grails record upload problems

how i emanate permitted url asp.net mvc?