Last active
December 14, 2015 04:49
-
-
Save chemikadze/5031170 to your computer and use it in GitHub Desktop.
What is the difference between `var x = null` and `var x = _`?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package initializing | |
class WithNull { var x: Any = null } | |
class WithUnderscore { var x: Any = _ } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PageObject(driver: WebDriver) { | |
WebDriverFactory.initElementsWithAjaxSupport(this,driver) | |
} | |
class FooPage(driver:WebDriver) extends PageObject(driver) { | |
@FindBy(name="bar") | |
private var barButton:WebElement = null // this is what all about | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public initializing.WithNull(); | |
Code: | |
0: aload_0 | |
1: invokespecial #19; //Method java/lang/Object."<init>":()V | |
4: aload_0 | |
5: aconst_null | |
6: pop | |
7: aconst_null | |
8: putfield #11; //Field x:Ljava/lang/Object; | |
11: return | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public initializing.WithUnderscore(); | |
Code: | |
0: aload_0 | |
1: invokespecial #19; //Method java/lang/Object."<init>":()V | |
4: return | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment