In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces the differences between scala::, +:,::, +, what is introduced in the article is very detailed, has a certain reference value, interested friends must read it!
The difference and relation of the four operators
:: this method is called cons, which means to construct, append data to the header of the queue and create a new list. The usage is x::list, where x is the element added to the header. Whether x is a list or not, it will only become the first element of the newly generated list, that is, the length of the newly generated list is + 1 (btw, x::list is equivalent to list.:: (x)).
: + and +: the difference between the two is that the + method is used to append elements to the tail, and the +: method is used to append elements to the header, which is similar to::, but:: can be used for pattern match, while +: is not. As for +: and: +, just remember that colons are always close to the collection type and OK.
+ + this method is used to join two sets, list1++list2.
: this method can only be used to join two collections of List type
Specific example scala > "A":: "B": Nilres0: List [String] = List (A, B) scala > "A" +: "B" +: Nilres1: List [String] = List (A, B) scala > Nil:+ "A": + "B" res2: List [String] = List (A, B) scala > res0 + + res1res3: List [String] = List (A, B, A, B) scala > res0:: res1res4: List [String] = List (A, B, A) B) scala > res0:: res1res5: List [java.io.Serializable] = List (List (A, B), A, B) these are all the contents of the article "what are the differences in scala::, +:,::, +" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.