Hi there! I'm new to java so im having some "annoying" problems. I have a class Employee which contains a int idNumber and a int phonenumber. Then i have a LinkedList sorted by idNumber. I want to change the phonenumber of a certain idnumber. I've been working with Iterators but i don't know if i'm doing it right, which i doubt.
public void setNewPhoneNumber(int idnumber, int newphone){
Iterator<IndexC> it = listEmployee.iterator();
IndexC employeeTemp = null;
boolean found = false;
while(it.hasNext() && !found){
employeeTemp = it.next();
if(employee.getIdNumber()== idnumber){
employeeTemp.setNewPhoneNumber(newphone);
found = true;
}
}
}
Yeah, i know employee.setNewPhoneNumber is wrong, but i don't know which the correct way change the value on the linkedlist. (Sorry for the bad english, not a native speaker)