Как Scala “заполняет” недостающие аргументы классу случая?

Чтобы изменить имя вашего приложения Android в Android Studio или Eclipse, вам нужно изменить значение свойства android:label, определенного внутри узла <application> в AndroidManifest.xml

 android:label="My Cool Application!"

по умолчанию имя приложения ссылается на строку, определенную в файле strings.xml, например:

 android:label="@string/app_name"

, поэтому нам нужно изменить значение внутри файла strings.xml:

  <string name="app_name">My Cool Application!</string>
6
задан oxbow_lakes 29 June 2009 в 14:29
поделиться

1 ответ

What you are sending is the singleton object Exit. In the Scala API, just scroll down past the classes, and look up the objects.

object Exit 
extends (AbstractActor, AnyRef) => Exit

Now, I haven't seen your code, so I don't know how you are using it. Notice, though, that this object Exit is (actually, extends) a function, which takes two parameters and returns an Exit case class formed by them. It will also have some stuff put in it by the case class statement.

Or, in other words, Exit.apply(x,y) (the function Exit being applied) has the same result as Exit(x,y) (the constructor for class Exit). But while you can't pass a class, you can pass an object.

2
ответ дан 17 December 2019 в 20:34
поделиться
Другие вопросы по тегам:

Похожие вопросы: