Reprinted from Fineqtbull http://fineqtbull.iteye.com/blog/477994One of the JE Students came to me and asked me about the Scala type parameter covariance, inversion, type upper bound and type of the lower bound of the use of methods and principles, although I have just learned, in the main investigation of the "programing in Scala" Chapter 19, try to do a summary below. If there are errors, please correct t
This article describes how to implement the basic Scala language types.Java basic type
Java data types can be roughly divided into two types: Basic (Primitive) Type and object type. There are eight basic types: Boolean, byte, short, Char, Int, long, float, and double. To integrate the basic types into the OO system, Java provides (Wrapper). Package class in packageJava. LangThere are a total of 8 corresponding to the basic types: Boolean, byte, short,
Built-in control structures built-in control structure 1 if control structure
Scala's if structure is the same as that of Java, and the function is not much different. Scala's saying is that if can return a value
Val filename = If (! Args. isempty) ARGs (0) else "default.txt"
This statement is relatively common, but a VaR is not introduced here, but the Val is used.
Println (filename) is equivalent to println (if (! Args. isempty) ARGs (0) else "default.txt"), which is also an advantage of Val,
There are many similarities between Scala and Java, but there are many differences. This is primarily a Java developer's perspective, summarizing some of the thinking changes that are faced in the process of using Scala. Here is just a summary of the two languages in the development process of the different, will be updated after some switching in the development process is worth noting. The following is a
Summary: When it comes to dealing with large-scale data, R, Python, Scala, and Java basically meet your requirements.
There is a big data project, you know the problem area (problem domain), you know what infrastructure to use, and maybe even decide which framework to use to process all of this data, but one decision has been delayed: which language should I choose? (or perhaps more specifically, the question is, what language should I force all
Guide to Scala development by chszs. Blog homepage: http://blog.csdn.net/chszs、下scala Scala
The latest version of Scala is 2.10.2. There are two release packages for Windows:
1) Windows (ZIP Archive) scala-2.10.2.zip
Windows (MSI) scala
Seventh step: Parameterized array with typeYou can instantiate an object or class instance using new in Scala. When you instantiate an object in Scala, you can parameterize it with values and types: parameterize. Parameterization means "set" it when you create an instance. Parameterize an instance with a value by passing the object in parentheses to the constructor of the instance. For example, the followin
There is a big data project, you know the problem area (problem domain), you know what infrastructure to use, and maybe even decide which framework to use to process all of this data, but one decision has been delayed: which language should I choose? (or perhaps more specifically, the question is, what language should I force all my developers and data scientists to use?) The question will not be postponed for too long, but will be decided sooner or later.Of course, nothing prevents you from usi
To the Scala website, download the Scala SDK, address: http://www.scala-lang.org/download/ademacbook-pro:scala-2.11. 6 apple$ wget http://downloads.typesafe.com/scala/2.11.6/scala-2.11.6.tgz?_ga= 1.266727886.1594027332.1432723613Unzip and configure:ademacbook-pro:scala-2.11. 6 apple$ tar-zxvf
Scala Eclipse SBT Application developmentGeneral steps for building eclipse to develop Scala applicationsFirst, the Environment preparation:1, scala:http://www.scala-lang.org/2. Scala IDE for eclipse:scala-ide.org3, sbt:http://www.scala-sbt.org/4. SBT Eclipse:https://github.com/typesafehub/sbteclipse typesafe an SBT for Eclipse helper that can help build eclipse5
Win7 installing Scala 2.111. Download Scala 2.11http://download.csdn.net/download/u014393736/7107595I really download the Scala installation files, in fact, is a compressed package, just need to extract the files can be!You can also download the MSI suffix file on the website to install it.The installation process is as follows:The advantage of downloading the MS
The main contents of this section
Trait Construction Order
Comparison of trait and classes
Pre-defined and lazy loading
Trait extension Classes
Self type
1 Trait Construction OrderIn the previous note, we mentioned that for trait that do not have a specific implementation and a field, it will eventually generate a bytecode file that is equivalent to the interface in Java, whereas for trait with specific implementations and fields, the bytecode file is compiled with
Mappings and tuples
Summary :A classic programmer's famous saying is: "If there is only one data structure, then use a hash table." A hash table , or more generally, a mapping , is one of the most flexible data structures. A map is a collection of key/value duality . Scala has a common term: tuples, which are aggregates of N objects, do not necessarily have the same type . duality is simply a n=2 tuple, and tuples are especially useful for
Scala supports associative mappings, such as a key-value pair that can be represented by (key, value)
All types in Scala are objects, including basic data types
The case statement in Scala is used to determine the received message, which is more than the switch...case in Java ... More focusedreceive{Case msg = action ()}
The
In the previous chapter we introduced and then used the interpreter to write simple Scala code, and here's how to write a Hello word! using eclipse
Open Eclipse. Create a new Scala Project. The first new words should be in other, name casually, then create a new Scala Object named "HelloWorld".
Unlike Scala and Java, t
To this chapter, the examples of all function texts refer only to the arguments passed in. For example, (x:int) => x > 0, the only variable used by the function body, x > 0, is x, which is defined as a function argument. However, you can also refer to variables defined elsewhere:
(x:int) => x + much/more.
51CTO Editorial Recommendations: A special topic in Scala programming languages
function to add "more" to the reference, but what is more it. From
=${java_home}/bin:$PATH
5 Execute java-version and javac-version if it can appear the instructions shown in Java installation complete Step Two: Install the Scala https://scala-lang.org/download/page to download1, wget https://downloads.lightbend.com/scala/2.12.6/scala-2.12.6.tgz2, unzip TAR-ZXF
Match use case class:
Case classes is used for pattern matching and case expression to specify the class. These are standard classes with special modifications: case. The following is a simple pattern that uses case class matching examples:
Object Test {
def main (args:array[string]) {
Val alice = new Person ("Alice", 25)
Val bob = new Person ("Bob", 32)
Val charlie = new Person ("Charlie", 32)
for (Person
Person Match {
Case person ("Alice") => println ("Hi alice!")
Case person ("Bob
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.