- 1

Can anyone suggest me a better code?

Dispatcher

5th Feb 2022, 3:12 PM
Mahatma Tefnakht
Mahatma Tefnakht - avatar
4 Answers
5th Feb 2022, 3:12 PM
Mahatma Tefnakht
Mahatma Tefnakht - avatar
0
Thanks Manav Roy
9th Feb 2022, 1:13 PM
Mahatma Tefnakht
Mahatma Tefnakht - avatar
0
But something does bother. If the name entered in parameter does not correspond to any listener in the list. What will the elmt.getName() statement give? public Listener getListener(String name){ Listener elmt=null ; for(int i=0;i<listeners.size();i++){ elmt=listeners.get(i); if(elmt.getName().equalsIgnoreCase(name)){ break ; } } return elmt; }
9th Feb 2022, 1:18 PM
Mahatma Tefnakht
Mahatma Tefnakht - avatar