[英]Scala: What does << mean?
I am very new to Scala. 我是Scala的新手。 I have been asked to implement a feature so I am reading the codebase.
我被要求实现一个功能,因此我正在阅读代码库。
I see the following: 我看到以下内容:
def * = (id ~: columns) <>(Account.<<.<<.<<.<<, (Account.unapply _).<<.<<.<<.<<)
...but I don't know what <<.<<.
...但是我不知道
<<.<<.
means, and Google did not gave me any correct result since it is a symbol. 意思是,Google并没有给我任何正确的结果,因为它是一个符号。
What is this called? 这个叫什么?
<< is just a normal method name in Scala. <<只是Scala中的常规方法名称。 It seems that in your code you have an Account object defined with a method name <<.
似乎在您的代码中,您有一个用方法名称<<定义的Account对象。 And that method returns another object that also has method <<.
该方法返回另一个也具有方法<<的对象。
You need to look at the help or implementation of the Account.<< method to see what it does. 您需要查看Account。<<方法的帮助或实现,以了解其作用。 There is nothing special in Scala regarding << that you should be concerned.
在Scala中,您不必担心<<的特殊之处。 It is all in your implementation.
这一切都在您的实现中。
将代码加载到IDE中(例如Scala IDE,Ensime或IDEA),并要求IDE转到该<<
的定义。
I am not very familiar with Scala, but since it looks like an operator, a quick Google search on "Scala operators" gives the Scala Operator Cheat Sheet 我对Scala不太熟悉,但是由于它看起来像运算符,因此Google对“ Scala运算符”的快速搜索为Scala运算符备忘单
This has the following on the <<
operator: <<
操作符具有以下内容:
<< BigInt Leftshift of BigInt
<< BigInt BigInt的左移
<< Byte<<字节
<< Char<<字符
<< Int<< Int
<< Long<<长
<< Short<<短
<< Buffer Send a message to this scriptable object.<<缓冲区向此可编写脚本的对象发送消息。
<< BufferProxy Send a message to this scriptable object.<< BufferProxy向此可编写脚本的对象发送消息。
<< Map Send a message to this scriptable object.<< Map向此可编写脚本的对象发送消息。
<< MapProxy Send a message to this scriptable object.<< MapProxy向此可编写脚本的对象发送消息。
<< Scriptable Send a message to this scriptable object.<<可编写脚本将消息发送到此可编写脚本的对象。
<< Set Send a message to this scriptable object.<<设置向此可编写脚本的对象发送消息。
<< SetProxy Send a message to this scriptable object.<< SetProxy向此可编写脚本的对象发送消息。
<< SynchronizedBuffer Send a message to this scriptable object.<< SynchronizedBuffer向此可编写脚本的对象发送消息。
<< SynchronizedMap Send a message to this scriptable object.<< SynchronizedMap向此可编写脚本的对象发送消息。
<< SynchronizedSet Send a message to this scriptable object.<< SynchronizedSet向此可编写脚本的对象发送消息。
As for the .
至于
.
, I think that would be a way of chaining things. ,我认为这是一种链接事物的方式。
Hence, one might be able to think of this as the <<
operator chained multiple times into Account
etc. 因此,人们可能会想到这一点,因为
<<
操作符多次链接到Account
等。
However, <<
might actually be a method defined somewhere instead of one of the above operators. 但是,
<<
实际上可能是在某处定义的方法,而不是上述运算符之一。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.