| Jun 18 | 8:55 AM |
| Mark M. | has entered the room |
| Mark M. | turned on guest access |
| Jun 18 | 9:25 AM |
| ndrocchietto_ivano | has entered the room |
| ndrocchietto_ivano |
Hello
|
| Mark M. |
hello, Ivano!
|
| ndrocchietto_ivano |
Mark
|
| Mark M. |
how can I help you today?
|
| ndrocchietto_ivano |
:( still juniorish
|
| ndrocchietto_ivano |
I initially had an array that need to compare to another one
|
| ndrocchietto_ivano |
View paste
|
| ndrocchietto_ivano |
then since I gotta do a POST request and some endpoint response is not clear, I have to compare the id of one list with the one of another one to find the match in my Adapter
|
| ndrocchietto_ivano |
the problem is that this method should return a boolean
|
| ndrocchietto_ivano |
instead if I write the following snippet I get back a List
|
| ndrocchietto_ivano |
View paste
|
| Jun 18 | 9:30 AM |
| ndrocchietto_ivano |
sorry wrong
|
| ndrocchietto_ivano |
View paste
|
| ndrocchietto_ivano |
how can I made a control between two id arrays, having back a true
|
| ndrocchietto_ivano |
instead of a List?
|
| Mark M. |
selectedClients.value is an Array<Client>?
|
| ndrocchietto_ivano |
is a BehaviourRelay a library from JW
|
| ndrocchietto_ivano |
so is a subject
|
| ndrocchietto_ivano |
but yes with value gives back a List<Client>
|
| ndrocchietto_ivano |
`value`
|
| Mark M. |
you have been saying "array", but you have been coding List -- in Kotlin, Array and List are different things
|
| ndrocchietto_ivano |
I am sorry I mean a List
|
| Mark M. |
OK
|
| Mark M. |
so, you want true if both List<Client> have the same length and all members have the same value for id
|
| Mark M. |
?
|
| ndrocchietto_ivano |
Absolutely
|
| ndrocchietto_ivano |
cannot work this out, nor find on SO some keyword
|
| ndrocchietto_ivano |
because is more a data structure skill which I lack still
|
| Mark M. |
hold on
|
| ndrocchietto_ivano |
sure thing
|
| Jun 18 | 9:35 AM |
| ndrocchietto_ivano |
thank you for your interest, and sorry for my abusing curiosity
|
| Jun 18 | 9:35 AM |
| Mark M. |
does order matter? List is ordered, so do the IDs have to appear in the same order?
|
| ndrocchietto_ivano |
no
|
| Jun 18 | 9:40 AM |
| Mark M. |
ah, too bad, because equals() should work if order was important: https://kotlinlang.org/api/latest/jvm/stdlib/ko...
|
| ndrocchietto_ivano |
View paste
|
| ndrocchietto_ivano |
well order is good as well
|
| ndrocchietto_ivano |
if they get sorted is not a problem guess
|
| Mark M. |
actually, equals() would only work if Client had an equals() that compared id values
|
| ndrocchietto_ivano |
mmh
|
| Mark M. |
View paste
|
| ndrocchietto_ivano |
I am going to look into
|
| Mark M. |
View paste
|
| Mark M. |
View paste
|
| ndrocchietto_ivano |
thank you very much
|
| ndrocchietto_ivano |
I am gonna implemtn
|
| ndrocchietto_ivano |
implement
|
| Jun 18 | 9:50 AM |
| Mark M. |
actually, equals() on the mapped lists is simpler
|
| Mark M. |
View paste
|
| Mark M. | |
| Jun 18 | 9:55 AM |
| ndrocchietto_ivano |
thank you Mark
|
| ndrocchietto_ivano |
Looks as a winner
|
| ndrocchietto_ivano |
quick win
|
| ndrocchietto_ivano |
I can improve these skills studying algorithms and data structure?
|
| Mark M. |
um, possibly
|
| ndrocchietto_ivano |
thank you, have a pleasant morning
|
| Mark M. |
you're welcome!
|
| Jun 18 | 10:00 AM |
| Mark M. |
that's a wrap for today's chat
|
| Mark M. |
the next chat is tomorrow at 4pm US Eastern
|
| Mark M. |
this transcript will be posted to https://commonsware.com/office-hours/ shortly
|
| ndrocchietto_ivano | has left the room |
| Mark M. | turned off guest access |