Java Programming Tutorial 74 - Searching a List for Custom Objects

preview_player
Показать описание


~~~~~~~~~~~~~~~ CONNECT ~~~~~~~~~~~~~~~

~~~~~~~~~~~~~~ SUPPORT ME ~~~~~~~~~~~~~~

🅑 Bitcoin - 3HnF1SWTzo1dCU7RwFLhgk7SYiVfV37Pbq
🅔 Eth - 0x350139af84b60d075a3a0379716040b63f6D3853
Рекомендации по теме
Комментарии
Автор

I had trouble understanding the invoking of the overload, but I figured it finally out and wrote it for you guys, who might have the same issue:

What happens here is that in the method (line 43) we are invoking overload that starts on line 47.
We do that by combining the fn and ln in line 44. Why? Because the overload expects a string of FULL NAME! But in the method (line 43), it only has names separately, so it does not concatenate them!
So, whenever you say that “hey, take the first name and ADD it to the last name”, you are automatically invoking the overload, since it has it in the argument. What happens then is that we are running the code that has the for-if statement, which iterates over the indexes and checks if the fullName is equal to the getFullname and returns the index where this match happened.

Hope it helps someone!

kawa_bata
Автор

We are pretty much accessing the second searchList method by calling the first one, you can make the second searchList(List, String fullname) private and the code still executes fine.
Cool.

jx_cob
Автор

I still get -1 even I do those changes. I cant type .strip(); because my eclipse is old. What should I do?

TheBitz
Автор

would you mind making videos on "Generic, Comparable Generic, Parameterized Types? Thank you

Selim_Hasan_Raj
Автор

Dis helped us wid our programming activity 👍♥️

rafaelangelopiad
Автор

Is line 51 why do you still need to call the .getFullName() method?

Victor-ktqn
Автор

How to do this without iterating over complete arraylist. I was asked this questn in an intrvw today.

FaizanShaikh-ppkg
Автор

I have a request but you seems not replying to any comment below.

rexsovelllejes