Java pass method reference as parameter to other method

前端 未结 5 1422
暗喜
暗喜 2021-02-04 07:53

I am trying to pass a selected \"get\"-method of class A to a method in class B. I have checked out Java Pass Method as Parameter, but I was not able to adopt the interface appr

5条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-04 08:25

    You can use Command Design Pattern

    for more info :

    https://en.wikipedia.org/wiki/Command_pattern http://www.tutorialspoint.com/design_pattern/command_pattern.htm

提交回复
热议问题