Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

head first 设计模式-0x05 #17

Open
ichengzi opened this issue May 31, 2020 · 0 comments
Open

head first 设计模式-0x05 #17

ichengzi opened this issue May 31, 2020 · 0 comments

Comments

@ichengzi
Copy link
Owner

ichengzi commented May 31, 2020

命令模式 Command

为了解耦, 引入了中间对象, Command

Command 对象用户执行一个action的所有参数,以及一个指向action的方法引用

感觉还是C里边的函数指针的封装, 类似c# 里的 delegate, java 的

  1. Function<T,R>, 返回R
  2. Consumer, 无返回
  3. Predicate, 返回bool
  4. Supplier, 返回T, 无入参
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant