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

问题描述 投票:0回答:1

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

package de.company.carbase

import de.company.carbase.model.Car

typealias CarSupplier = () -> Car

我将其命名为cars-utils.kt。仅小写字母,并故意用连字符将其与常规类文件区分开。

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

kotlin naming
1个回答
0
投票

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

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
© www.soinside.com 2019 - 2024. All rights reserved.