我是Java新手,有点从C#过渡到Java.
java.util.function有一个接口定义为Function输入到computeIfAbsent方法Map.
我想定义并将该函数委托给computeIfAbsent方法.
map.computeIfAbsent(key, k => new SomeObject())
Run Code Online (Sandbox Code Playgroud)
工作,但我希望它与func回调.但问题是Function需要定义输入参数.如何将其设置为void或不设置参数.
map.computeIfAbsent(key, func);
Run Code Online (Sandbox Code Playgroud) 我在我的 html 中添加了一个 mat-hint 元素。我只想在用户关注相应的表单字段时显示 mat-hint 并隐藏 focusout 的提示。如何为所有表单域实现这个场景。
<mat-hint align="end">Max 50 characters</mat-hint>
Run Code Online (Sandbox Code Playgroud) 我使用{useHash:true}配置了我的 angular 8 应用程序路由。
例如,当我在浏览器中打开一个 url 时
https://localhost:4200/#/todo
https://localhost:4200/#/todo/12
Run Code Online (Sandbox Code Playgroud)
我不希望在 # 之后立即添加 /。必须以角度添加什么配置才能实现上述目标。
https://localhost:4200/#todo
https://localhost:4200/#todo/12
Run Code Online (Sandbox Code Playgroud)
我有这个要求,以便我的 url 与加载到 angular 应用程序中的非 angular 微服务的路由兼容
我有 2 个名为 METADATA_SUCCESS_ACTION_1 和 SUCCESS_ACTION_2 的操作。我如何等待这两个操作完成,然后订阅合并数据。
this.actions
.pipe(
ofType(METADATA_SUCCESS_ACTION_1),
take(1)
)
.subscribe((data1: any) => {
console.log(data1)
});
this.actions
.pipe(
ofType(SUCCESS_ACTION_2),
take(1)
)
.subscribe((data2: any) => {
console.log(data2)
});
Run Code Online (Sandbox Code Playgroud)
我想等待两次成功发生,然后处理作为元数据和成功数据的数据