Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVA

java comparator comparing

1. Collections.sort(people,Comparator.comparing(Person::getLastName));

2.		Collections.sort(list,
		        Comparator.<Integer,Integer>comparing( i -> -grow[i])
		                  .thenComparing( i -> -plant[i]));

3.		Collections.sort(list,
		        Comparator.comparing( (Integer i) -> -grow[i])
		                  .thenComparing( i -> -plant[i]));

4.		Collections.sort(list,
		        Comparator.comparing( i -> -grow[(int)i])
		                  .thenComparing( i -> -plant[(int)i]));

Source by www.webucator.com #
 
PREVIOUS NEXT
Tagged: #java #comparator #comparing
ADD COMMENT
Topic
Name
6+6 =