Lesson 33 of 34
Sorting, Comparator மற்றும் LambdasSorting, Comparators and Lambdas
10 min 35 XP
Collections.sort() எண்களையும் String-களையும் வரிசைப்படுத்தும். Objects-ஐ வரிசைப்படுத்த Comparator தேவை. Lambda (a, b) -> ... என்பது சிறிய method-ஐ ஒரே வரியில் எழுதும் வழி.
Collections.sort() sorts numbers and Strings. To sort objects you need a Comparator. A lambda like (a, b) -> ... writes a small method in one line.
Example: edit me and press Run
Press Run to see the result here.Streams மூலம் filter, map போன்றவற்றை சுருக்கமாக எழுதலாம். Modern Java interviews-ல் இவை அடிக்கடி வரும்.
Streams let you filter and transform collections in a few words. Modern Java interviews ask about them often.
Example: edit me and press Run
Press Run to see the result here.