Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CSDN 技术社区
skill_tree_java
提交
11249b1c
S
skill_tree_java
项目概览
CSDN 技术社区
/
skill_tree_java
通知
43
Star
8
Fork
4
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
4
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
skill_tree_java
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
4
Issue
4
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
11249b1c
编写于
3年前
作者:
M
Mars Liu
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
sam
上级
dfcfed12
master
无相关合并请求
变更
4
隐藏空白更改
内联
并排
Showing
4 changed file
with
58 addition
and
34 deletion
+58
-34
data/3.Java高阶/1.通过行为参数化传递代码/1.应对不断变化的需求/config.json
data/3.Java高阶/1.通过行为参数化传递代码/1.应对不断变化的需求/config.json
+0
-33
data/3.Java高阶/1.通过行为参数化传递代码/3.简写/config.json
data/3.Java高阶/1.通过行为参数化传递代码/3.简写/config.json
+2
-1
data/3.Java高阶/1.通过行为参数化传递代码/3.简写/sam.json
data/3.Java高阶/1.通过行为参数化传递代码/3.简写/sam.json
+0
-0
data/3.Java高阶/1.通过行为参数化传递代码/3.简写/sam.md
data/3.Java高阶/1.通过行为参数化传递代码/3.简写/sam.md
+56
-0
未找到文件。
data/3.Java高阶/1.通过行为参数化传递代码/1.应对不断变化的需求/config.json
已删除
100644 → 0
浏览文件 @
dfcfed12
{
"node_id"
:
"java-0a39f4040da04b8591f9b36f3c446789"
,
"keywords"
:
[],
"children"
:
[
{
"初试牛刀:筛选绿苹果"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"java-e888465b1043473fbb919fd4958e3179"
,
"title"
:
"初试牛刀:筛选绿苹果"
}
},
{
"再展身手:把颜色作为参数"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"569d5e11c4fc5de7844053d9a733c5e8"
,
"title"
:
"再展身手:把颜色作为参数"
}
},
{
"第三次尝试:对你能想到的每个属性做筛选"
:
{
"keywords"
:
[],
"children"
:
[],
"node_id"
:
"569d5e11c4fc5de7844053d9a733c5e8"
,
"title"
:
"第三次尝试:对你能想到的每个属性做筛选"
}
}
],
"export"
:
[],
"title"
:
"应对不断变化的需求"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
data/3.Java高阶/1.通过行为参数化传递代码/3.
对付啰唆
/config.json
→
data/3.Java高阶/1.通过行为参数化传递代码/3.
简写
/config.json
浏览文件 @
11249b1c
...
...
@@ -34,6 +34,6 @@
}
}
],
"export"
:
[],
"export"
:
[
"sam.json"
],
"title"
:
"对付啰唆"
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
data/3.Java高阶/1.通过行为参数化传递代码/3.简写/sam.json
0 → 100644
浏览文件 @
11249b1c
This diff is collapsed.
Click to expand it.
data/3.Java高阶/1.通过行为参数化传递代码/3.简写/sam.md
0 → 100644
浏览文件 @
11249b1c
# Single Abstract Method
下面哪一个类型定义,在构造其对象时,可以简化为 lambda?
## 答案
```
java
public
interface
Parsec
<
E
,
T
>
{
default
T
ask
(
State
<
E
>
state
)
{
try
{
return
new
Success
(
this
.
parse
(
state
));
}
catch
(
Exception
error
){
return
new
Failure
(
error
);
}
}
T
parse
(
State
<
E
>
state
);
}
```
## 选项
### SAM 需要 interface
```
java
public
abstract
class
Element
{
String
read
();
void
write
(
String
content
);
}
```
### 有两个未定义方法
```
java
public
interface
Element
{
String
read
();
void
write
(
String
content
);
}
```
### 没有抽象方法,无法按 SAM 处理
```
java
public
class
Cell
{
String
content
;
public
Cell
(
String
content
){
this
.
content
=
content
;
}
public
String
text
()
{
return
content
;
}
public
String
text
(
String
content
){
this
.
content
=
content
;
}
}
```
This diff is collapsed.
Click to expand it.
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录
反馈
建议
客服
返回
顶部