![]() |
.. (לתיקייה המכילה) | |
In User interface , what should rateSong, addFriend return ? | |
They should return the current user ( this ) |
How should favoriteSongInCommon behave ? | |
It should behave like this : ( lets assume that there are two users: A & B and they both already rated the same song with 8+ ) // ---------------------------- A.AddFriend(B) A.favoriteSongInCommon(B) // should return true // ---------------------------- A.AddFriend(B) B.AddFriend(A) A.favoriteSongInCommon(B) // should return true // ---------------------------- B.AddFriend(A) A.favoriteSongInCommon(B) // should return false |
In getHighestRatedSongs , getMostRatedSongs & getTopLikers , can we assume that num will be non-negative ? | |
Yes |
In every method that takes a reference semantics variable , can we assume that it will not be null ? | |
Yes , apart from equals which should be able to handle null other methods can assume that the input variables will not be null . |
In a method which receives an object as an input and i want to save that object inside an inner data structure , do i need to clone it or can i save it as it is ? | |
You can save it as it is |
If we have a song that nobody rated it with X value, getRatings method should return a map with key X and empty value or it should return a map without key X at all ? | |
It should return a map without key X at all , and if nobody rated the song at all it should return an empty map .... |
In rateSong method ( both in User and Song ) , what is the meaning of "It is not allowed to change the input object (user/song) " , and why one of these | |
The meaning of "It is not allowed to change the input object (user/song) " is that you can't do some operation on the object(user/song) that changes it's inner field's value ( just like calling addFriend and rateSong ) . final is a typo ,but it should not affect you solution (the solution should be the same with or without final ) . One more thing, final will not help you here since it forbids us from changing the variable's reference and not it's value ( i.e you can change the value of a final variable as long as it isn't a primitive variable ) , so in rateSong method you should make sure by yourself that you didn't change the input object's value(inner field's value) .... |
How to implement Iterable<Song> in TechnionTunesImpl ? | |
You should implement iterator() method which returns an Iterator<Song> "object" , this Iterator<Song> "object" should have hasNext() and next() methods as described in tutorial 3 . |