View Single Post
  #4 (permalink)  
Old 08-02-2007, 04:26 PM
shanePreater shanePreater is offline
Member
 
Join Date: Jul 2007
Location: England, Bath
Posts: 47
shanePreater is on a distinguished road
I was more after the code around what you have here.
How are you obtaining the student instance which you are passing in to this method?
Do you have a get method on this class which does :
Code:
students.get(n);
somewhere in it? like:
Code:
public Student findWithName(String name) { Student student = null; Iterator<Student> iterator = students.iterator(); while(null == student && iterator.hasNext()) { Student potential = iterator.next(); if(potential.getName.equalsIgnoreCase(name)) { student = potential; } } return student; }
If this is the case then passing the returned student into the remove function should work, however if you have created a new instance of Student then this may not work.
Can you show me the code which calls remove and also the code for Student?

Thanks.
__________________
Shane Preater -
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Reply With Quote