简体   繁体   English

Scala-检查是否导入了一个类

[英]Scala - Check if a class is imported or not

In Scala console the command: 在Scala控制台中,命令:

import testPackage._

will give the below output: 将给出以下输出:

scala> import testPackage._
import testPackage._

But after importing how to check what are the classes imported in the console or how to list the classes (of testPackage) in the console (just for verification). 但是在导入之后,如何检查在控制台中导入了哪些类,或者如何在控制台中列出(testPackage的)类(仅用于验证)。 Please help. 请帮忙。

Within the REPL I'm not sure if there's a command for listing all imported classes, however what you can do is use the tabbed completion, just type in: 在REPL中,我不确定是否有列出所有导入类的命令,但是您可以使用制表符完成,只需键入:

scala> val tmp : testPackage.

and then hit TAB. 然后点击TAB。 You should get a list of the types available within that scope. 您应该获得该范围内可用类型的列表。

HTH 高温超导

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM