【问题标题】:java - Usage of 'of' keyword when defining a method [closed]java - 定义方法时使用'of'关键字[关闭]
【发布时间】:2013-12-27 01:15:21
【问题描述】:

在反应堆代码中,我可以看到类似的东西

/**
 * Create a {@link Tuple1} with the given object.
 *
 * @param t1   The first value in the tuple.
 * @param <T1> The type of the first value.
 * @return The new {@link Tuple1}.
 */
public static <T1> Tuple1<T1> of(T1 t1) {
    return new Tuple1<T1>(t1);
}

这个'of'关键字是什么?

【问题讨论】:

  • 这是方法的名称
  • @SotiriosDelimanolis 我喜欢答案像这样递归:))))))))))))))))
  • 该死!你说的对!我只是忽略了,想知道这是什么“的”。谢谢
  • 草率的命名约定
  • @user2310289 呵呵,我觉得有点用(虽然我承认,这两个不一定是互斥的)。

标签: java keyword reactor


【解决方案1】:

您看到的不是新的of 关键字。它实际上是方法的名称,尽管它可能看起来不像。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2011-06-09
    • 2016-12-31
    • 2017-02-16
    • 2015-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-04
    相关资源
    最近更新 更多