【问题标题】:Generate inline class for method call parameter in Eclipse在 Eclipse 中为方法调用参数生成内联类
【发布时间】:2016-06-15 00:35:58
【问题描述】:

当调用一个期望实现特定类的方法时,如何让 eclipse 为我编写这段无聊的代码?

在下面的例子中,只有第一行需要人工编写:

o.call(
new MyFunction<List<String>>()
                {

                    @Override
                    public void call(List<String> lst) throws Exception {
   }
}

【问题讨论】:

    标签: eclipse inline-code


    【解决方案1】:

    键入o.call(new MyF 然后Ctrl+Space 并且Eclipse 应该为您提供完成匿名类骨架。您甚至可能不需要 new MyF 部分,这取决于上下文的明确程度。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-05-06
      • 1970-01-01
      • 2011-09-12
      • 2011-10-14
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-17
      相关资源
      最近更新 更多