摘要: 1 默认方法 默认方法存在的意义就是向后兼容,避免以前版本的代码不支持新版本。如果这里的sort是一个接口,没有实现,那么以前使用List的实现不都得实现该接口 2 stream 2.1 接口说明 /** * A sequence of elements[元素的序列] supporting sequ 阅读全文
posted @ 2021-03-02 15:36 谁给起个名 阅读(67) 评论(0) 推荐(0)
摘要: 1 方法引用 方法引用:method reference 方法引用本质上是lambda表达式的一种语法糖 我们可以将方法引用看作是一个【函数指针】,function pointer 1.1 类名::静态方法 list里面有自身的sort方法,方便排序.返回值为void,说明是原地排序,修改的是原数组 阅读全文
posted @ 2021-02-24 15:36 谁给起个名 阅读(81) 评论(0) 推荐(0)
摘要: 1 Supplier理解 1.1 JavaDoc阅读 /** * Represents a supplier(供应者) of results. * * <p>There is no requirement that a new or distinct result be returned each 阅读全文
posted @ 2021-02-24 01:06 谁给起个名 阅读(362) 评论(0) 推荐(0)
摘要: 1 lambda依赖上下文 1.1 测试lambda表达式 public class Test3 { public static void main(String[] args) { TheInterface1 t1 = () -> {}; TheInterface2 t2 = () -> {}; 阅读全文
posted @ 2021-02-20 13:54 谁给起个名 阅读(118) 评论(0) 推荐(0)
摘要: 1 lamnbda 1.1 什么是lambda lambda:In programming languages such as lisp, python and ruby lambda is an operator used to denote anonymous functions(匿名函数) o 阅读全文
posted @ 2021-02-19 16:16 谁给起个名 阅读(63) 评论(0) 推荐(0)
摘要: 学习:https://blog.csdn.net/xiaoliulang0324/article/details/79030752 1、类添加注释(注意点) 2、函数添加注释(注意点) 阅读全文
posted @ 2021-01-08 13:43 谁给起个名 阅读(101) 评论(0) 推荐(0)
摘要: 1、https://segmentfault.com/a/1190000020086816 2、demo验证 package main import ( "bytes" "encoding/json" "fmt" "io/ioutil" "log" "net/http" _ "net/http/pp 阅读全文
posted @ 2020-10-15 15:57 谁给起个名 阅读(686) 评论(0) 推荐(0)
摘要: 70. 爬楼梯 假设你正在爬楼梯。需要 n 阶你才能到达楼顶。 每次你可以爬 1 或 2 个台阶。你有多少种不同的方法可以爬到楼顶呢? 注意:给定 n 是一个正整数。 class Solution { public: int climbStairs(int n) { if(n <= 1) retur 阅读全文
posted @ 2020-07-02 01:18 谁给起个名 阅读(134) 评论(0) 推荐(0)
摘要: https://zhuanlan.zhihu.com/p/47754783 阅读全文
posted @ 2020-06-30 17:07 谁给起个名 阅读(361) 评论(0) 推荐(0)
摘要: 给定一个整数 n,生成所有由 1 ... n 为节点所组成的 二叉搜索树 。 输入:3 输出: [ [1,null,3,2], [3,2,null,1], [3,1,null,null,2], [2,1,3], [1,null,2,null,3] ] 解释: 以上的输出对应以下 5 种不同结构的二叉 阅读全文
posted @ 2020-06-27 18:35 谁给起个名 阅读(430) 评论(0) 推荐(0)