You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.2 KiB
Java
37 lines
1.2 KiB
Java
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Maps;
|
|
|
|
import java.util.*;
|
|
import java.util.stream.Collectors;
|
|
|
|
public class TestObj {
|
|
public static void main(String[] args) throws Exception{
|
|
List<Map<String,Object>> list = Lists.newArrayList();
|
|
Map<String,Object> map1 = Maps.newHashMap();
|
|
Map<String,Object> map2 = Maps.newHashMap();
|
|
Map<String,Object> map3 = Maps.newHashMap();
|
|
map1.put("betweenMinutes","1");
|
|
map2.put("betweenMinutes","10");
|
|
map3.put("betweenMinutes","5");
|
|
list.add(map1);
|
|
list.add(map2);
|
|
list.add(map3);
|
|
List<Map<String,Object>> sortOffsetAskForLeaveAnomalyList = list.stream().sorted(Comparator.comparing(e->Integer.valueOf(e.get("betweenMinutes").toString()))).collect(Collectors.toList());
|
|
System.out.println(sortOffsetAskForLeaveAnomalyList);
|
|
|
|
int total = sortOffsetAskForLeaveAnomalyList.stream().mapToInt(e->Integer.valueOf(e.get("betweenMinutes").toString())).sum();
|
|
System.out.println(total);
|
|
}
|
|
|
|
|
|
public static int aa(){
|
|
for (int i=0;i<=3;i++){
|
|
|
|
if (i==2){
|
|
return 2;
|
|
}
|
|
}
|
|
return -1;
|
|
}
|
|
}
|