How to compare two strings in scala? -


I want to compare two strings in Slálla. For example,

My strings are:

  Scala Java Scala Java c ++ scala c ++   

I string I want to compare

  scala c ++ = scala java // false scala C ++>  

= Scala Java C ++ // false Sky C + + = Scala c ++ // true

In Scala you can see the ==

  scala> "Scala C ++" == "Scala Java" res0: Boolean = false mark & ​​gt; "Scala C ++" == "Scala Java C ++" Race 1: Boolean = false scale & gt; "Scala C ++" == "Scala C ++" Rage 2: Boolean = True   

== The method is defined in anyRef class. Since the methods first check for zero values, and then call the method equal to the first object, to see if two objects are equal, you do not need to check the special tap;

  "test" == Rick Reset: Boolean = False   

See more

"";

Boolean) For reference types, == is treated as the alias of java.lang.Object with the par method. Originally defined as the context of equality, but for the equality of these subclasses For the implementation of natural perception means being override in subclasses is . For example, the box type of the value type will apply the same method that compares the boxing values. In contrast, in Java, == always Reference equality means the context types. Although it is slightly more efficient to implement, it also introduces a serious coherence problem because the box of similar values Now versions can not be equal in relation to == Some situations require reference parity instead of user-like parity. For example, H-feeders, where ECC is paramount. For these cases, the class AnyRef defines an additional eq method, which can not be overridden, and it is applied as reference equality (i.e. , For == reference types in Java). "

Comments

Popular posts from this blog

java - ImportError: No module named py4j.java_gateway -

python - Receiving "KeyError" after decoding json result from url -

.net - Creating a new Queue Manager and Queue in Websphere MQ (using C#) -