+ 2

how to remove or update array? JAVA

If user input information in an array, how to remove or update them? This is pretty long code. https://code.sololearn.com/c5B61NSOUsn7 I don't even know how to start it... thank you for any help or comments!

15th Jun 2017, 12:56 AM
Kurt Cobain
Kurt Cobain - avatar
1 ответ
+ 1
Search for the data: based on its name?email? perform a loop and end the loop when it reaches the last data when it finds the data, use the data's array number for(int i=0; i<studentList.size(); i++){ student = (Student) studentList.get(i); if ( student.getName().equalsIgnoreCase(searchedName){ //assign to the object here found = true; } } this is to update the data if you want to remove the data be sure to decrement the array size after delete I only remember completing tasks using data structure and I forgot about some java basics which is pretty bad
15th Jun 2017, 1:42 AM
Ahmad Faris Azrai
Ahmad Faris Azrai - avatar