Created
June 14, 2017 09:18
-
-
Save shybovycha/9431c5b82c826ced439490c100bfb093 to your computer and use it in GitHub Desktop.
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
Compiled from "Chaining.java" | |
public class Chaining { | |
public Chaining(); | |
Code: | |
0: aload_0 | |
1: invokespecial #1 // Method java/lang/Object."<init>":()V | |
4: aload_0 | |
5: ldc #2 // String 111111111111111111111111 | |
7: putfield #3 // Field a1:Ljava/lang/String; | |
10: aload_0 | |
11: ldc #4 // String 222222222222222222222222 | |
13: putfield #5 // Field a2:Ljava/lang/String; | |
16: aload_0 | |
17: ldc #6 // String 333333333333333333333333 | |
19: putfield #7 // Field a3:Ljava/lang/String; | |
22: return | |
public java.lang.String typicalChaining(); | |
Code: | |
0: new #8 // class java/lang/StringBuilder | |
3: dup | |
4: invokespecial #9 // Method java/lang/StringBuilder."<init>":()V | |
7: aload_0 | |
8: getfield #3 // Field a1:Ljava/lang/String; | |
11: invokevirtual #10 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; | |
14: aload_0 | |
15: getfield #5 // Field a2:Ljava/lang/String; | |
18: invokevirtual #10 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; | |
21: aload_0 | |
22: getfield #7 // Field a3:Ljava/lang/String; | |
25: invokevirtual #10 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; | |
28: invokevirtual #11 // Method java/lang/StringBuilder.toString:()Ljava/lang/String; | |
31: areturn | |
public java.lang.String noChaining(); | |
Code: | |
0: new #8 // class java/lang/StringBuilder | |
3: dup | |
4: invokespecial #9 // Method java/lang/StringBuilder."<init>":()V | |
7: astore_1 | |
8: aload_1 | |
9: aload_0 | |
10: getfield #3 // Field a1:Ljava/lang/String; | |
13: invokevirtual #10 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; | |
16: pop | |
17: aload_1 | |
18: aload_0 | |
19: getfield #5 // Field a2:Ljava/lang/String; | |
22: invokevirtual #10 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; | |
25: pop | |
26: aload_1 | |
27: aload_0 | |
28: getfield #7 // Field a3:Ljava/lang/String; | |
31: invokevirtual #10 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; | |
34: pop | |
35: aload_1 | |
36: invokevirtual #11 // Method java/lang/StringBuilder.toString:()Ljava/lang/String; | |
39: areturn | |
public java.lang.String concatenation(); | |
Code: | |
0: new #8 // class java/lang/StringBuilder | |
3: dup | |
4: invokespecial #9 // Method java/lang/StringBuilder."<init>":()V | |
7: aload_0 | |
8: getfield #3 // Field a1:Ljava/lang/String; | |
11: invokevirtual #10 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; | |
14: aload_0 | |
15: getfield #5 // Field a2:Ljava/lang/String; | |
18: invokevirtual #10 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; | |
21: aload_0 | |
22: getfield #7 // Field a3:Ljava/lang/String; | |
25: invokevirtual #10 // Method java/lang/StringBuilder.append:(Ljava/lang/String;)Ljava/lang/StringBuilder; | |
28: invokevirtual #11 // Method java/lang/StringBuilder.toString:()Ljava/lang/String; | |
31: astore_1 | |
32: aload_1 | |
33: areturn | |
} |
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 class Chaining { | |
private String a1 = "111111111111111111111111"; | |
private String a2 = "222222222222222222222222"; | |
private String a3 = "333333333333333333333333"; | |
public String typicalChaining() { | |
return new StringBuilder().append(a1).append(a2).append(a3).toString(); | |
} | |
public String noChaining() { | |
StringBuilder sb = new StringBuilder(); | |
sb.append(a1); | |
sb.append(a2); | |
sb.append(a3); | |
return sb.toString(); | |
} | |
public String concatenation() { | |
String result = a1 + a2 + a3; | |
return result; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment