chonh

chonh

V2EX member #285081, joined on 2018-01-21 19:50:57 +08:00
如何屏蔽脉脉骚扰电话?
问与答  •  chonh  •  May 28, 2024  •  Lastly replied by Ericcccccccc
6
请教一个 lambda 表达式的问题
Java  •  chonh  •  Jul 5, 2021  •  Lastly replied by chonh
2
如何解决安装 react-app 遇到的的网络问题
React  •  chonh  •  Jul 4, 2020  •  Lastly replied by buffzty
14
chonh's recent replies
mojo?
May 28, 2024
Replied to a topic by chonh 问与答 如何屏蔽脉脉骚扰电话?
@Ericcccccccc 机器人电话,放着没用


@huaxing0211 电话短信号都会变,没法屏蔽。这垃圾公司都懒得投诉它
May 28, 2024
Replied to a topic by chonh 问与答 如何屏蔽脉脉骚扰电话?
@erwin985211 注销还得登陆 app 吧,就怕一登录再来几年的骚扰电话
感谢楼主贴的代码,基本认同#14 楼的。
1. 主要是隐藏实现。小写的 service struct 是具体实现不会对外暴露。
2. Service interface 一看就知道提供了哪些功能,方便别人使用。而 struct 可能实现多个接口,会显示“多余”的方法。
3. interface 好扩展。将实现了 Y interface 的 B struct 嵌套在 A struct 里,A 自动实现 Y 。但 A 并不会成为 B 。
4. 如果返回 interface ,那只能 return struct (或 func )。因为 interface 不能实现 interface 。
5. 如果你的 struct 只是充当 data model ,一般会直接写 struct literal ,不需要额外加个 NewXXX 方法。
6. 这跟继承不继承没关系。
楼主能举个例子吗,没看懂 [接受接口,返回结构体] 具体指啥
Jun 13, 2022
Replied to a topic by ak1ak Java 关于 Java 泛型方法定义的疑惑
PECS: producer extend consumer super.

Function 改为? super A1 即可。
详细解释可以搜 so
Apr 21, 2022
Replied to a topic by sardina 职场话题 有去过华为 od 的么,里面怎么样
@blockmin od 入职了还能转其他部门吗
Jul 5, 2021
Replied to a topic by chonh Java 请教一个 lambda 表达式的问题
@codergrowing 感谢回答!

你给的这个链接讲解得很清楚:

https://moandjiezana.com/blog/2014/understanding-method-references/


“当实例方法被用做 Method Reference 的时候,receiver 会将 this 作为第一个参数传入”

这句话没看太懂。我感觉是:实例方法转为 lambda 时,lambda 的第一个参数作为实例对象,lambda 的后续参数作为实例方法的参数。


原文的说法是:

when converting a method reference to a lambda, “if the desugared method is an instance method, the receiver is considered to be the first argument”. Also, the lambda’s remaining arguments are passed as arguments to the referred method.
May 3, 2021
Replied to a topic by join English 我的英语学习经验 - 完整版
感谢分享,楼主写得很实用
About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3288 Online   Highest 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 50ms · UTC 11:55 · PVG 19:55 · LAX 04:55 · JFK 07:55
♥ Do have faith in what you're doing.