
Java
HiLoword
这个作者很懒,什么都没留下…
展开
-
Java8对List<Map<String,String>>自定义排序
List<Map<String,String>> arrayList = new ArrayList<>(); Map<String, String> securityMap1 = new HashMap<>(); securityMap1.put("name","期货"); securityMap1.put("value","100.11"); arrayList.add(secu原创 2020-12-11 00:38:23 · 3036 阅读 · 1 评论 -
Java8 groupingBy对map分类求和
根据性别进行汇总,求男女的年龄总和public static void main(String[] args) { List<Map<String,String>> arrayList = new ArrayList<>(); Map<String, String> map1 = new HashMap<>(); map1.put("gender","女"); map1.put(原创 2020-12-06 22:19:19 · 2246 阅读 · 0 评论 -
Spring Spel表达式动态计算
假如数据库查询出来的结果保存在Map中 如微博账号的查询结果Map<String,Integer> map = new HashMap<>(); map.put("reposts_count",10); map.put("comments_count",12); map.put("praises_count",3); map.put("post_count",5);...翻译 2020-11-20 16:59:07 · 2839 阅读 · 0 评论 -
String创建字符串相关解析
String s = new String(“xyz”);解析:生成3个对象,一个常量池对象"xyz",一个堆对象new String(“xyz”),一个引用对象s。String s = new String(“xyz”) + “xyz”;解析:生成3个对象,一个常量池对象"xyz",一个堆对象 new String(“xyz”),一个引用对象s。(后面的“xyz”不会再创建了,因为前面的new String(“xyz”)已经创建了一个常量池对象"xyz")String s = new String原创 2020-11-06 15:42:14 · 264 阅读 · 0 评论 -
Java8新特性:函数式编程、lambda表达式
Function<T, R>转换函数函数式接口定义:仅含有一个抽象方法的接口@FunctionalInterface/** * Applies this function to the given argument. * * @param t the function argument * @return the function result */public interface Function<T, R> { R apply(T t);}原创 2020-10-23 17:40:30 · 164 阅读 · 0 评论