Kotlin中实用程序集合的首选文件命名约定是什么?

作为Kotlin的新手,我不确定以下文件的正确名称:

<section id="tue" class="t">
  <h2>Tuesday</h2>
  <span>tue-1</span>
  <span>tue-7</span>
  <div>
    <span>tue-7-1</span>
    <div>
      <span>tue-7-1-1</span>
      <!-- end of target -->
      <span>tue-7-1-2</span>
    </div>
    <span>tue-7-2</span>
    <div>
      <span>tue-7-2-1</span>
      <div>
        <span>tue-7-2-1-1</span>
      </div>
      <span>tue-7-2-2</span>
</section>

我将其命名为package de.company.carbase import de.company.carbase.model.Car typealias CarSupplier = () -> Car 。只有小写字母,并故意用连字符将其与常规类文件区分开。

这对我来说似乎还可以,但是也许我错过了一个确定的惯例?

wrnmb38 回答:Kotlin中实用程序集合的首选文件命名约定是什么?

毫无疑问,正确答案应该是:CarDeclarations.kt,正如Tenfour04在上面指出的那样。

,

文件的Kotlin命名约定与类,对象,接口,枚举等相同。

HelperUtil.kt

package org.example.project

fun simpleFunction(thing: Int): Int {}

现在其他文件通过这样导入来使用它:

OtherFile.kt

import org.example.project.simpleFunction

// simpleFunction can now be used in this file
本文链接:https://www.f2er.com/3092859.html

大家都在问