Lesson 33 of 34

Sorting, Comparators, Lambdas

10 min 35 XP

Collections.sort() സംഖ്യകളും Strings-ഉം sort ചെയ്യുന്നു. Objects sort ചെയ്യാൻ Comparator വേണം. (a, b) -> ... പോലുള്ള lambda ഒരു ചെറിയ method ഒറ്റ വരിയിൽ എഴുതുന്നു.

Example: edit me and press Run

Output Loading Java (first time takes a few seconds)
Press Run to see the result here.

Streams ഉപയോഗിച്ച് collections കുറച്ച് വാക്കുകളിൽ filter, transform ചെയ്യാം. ആധുനിക Java interviews-ൽ ഇവയെക്കുറിച്ച് പലപ്പോഴും ചോദിക്കാറുണ്ട്.

Example: edit me and press Run

Output Loading Java (first time takes a few seconds)
Press Run to see the result here.

Challenge

+35 XP

n വായിക്കൂ, പിന്നെ name, score എന്നിവയുടെ n വരികൾ. score അനുസരിച്ച്, ഏറ്റവും കൂടുതൽ ആദ്യം, print ചെയ്യൂ; score തുല്യമെങ്കിൽ name അനുസരിച്ച് A മുതൽ Z. Input: 3 Ram 80 Asha 95 Bala 80 Output: Asha 95 Bala 80 Ram 80

Output Loading Java (first time takes a few seconds)
Press Run to see the result here.