java - Removing element from priority queue -


i'm trying pass input servlet backend, , remove object queue if information matches.

segment webpage user inputs name of project want delete below reads input attempts send data back-end java file holding priority queue

this section aimed @ reading in input form form calls processdeletejobs called readdeletejobs above.

readin in deletejobs input, set jobrequest element testdelete send off function in end

public boolean deletejobfrontend(jobrequest job) { boolean remove; remove = scheduledjobs.remove().equals(job.getprojectname()); return remove; } 

the aim remove jobrequest in priorityqueue if criteria matches if projectname within jobrequest matched remove queue unsure on boolean implementation whether remove correctly or not.

very novice can see

just remove calling priorityqueue.remove(object obj):

public boolean deletejobfrontend(jobrequest job) {     return scheduledjobs.remove(job); } 

also, make sure jobrequest has equals() implemented correctly.

or use iterator:

iterator = scheduledjobs.iterator(); while(it.hasnext()) {     if(samejob(it.next())) // implement samejob          it.remove(); } 

Comments

Popular posts from this blog

node.js - Bad Request - node js ajax post -

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -