Last active
September 10, 2015 06:46
-
-
Save jsyeo/5c6a5e0e23dcfe6c0661 to your computer and use it in GitHub Desktop.
Lambdas
This file contains hidden or 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
import java.util.Arrays; | |
import java.util.stream.Collectors; | |
public class Main { | |
public static void main(String[] args) { | |
// write your code here | |
System.out.println(Arrays.asList(1, 2, 3).stream().map(x -> x * x).collect(Collectors.toList())); | |
} | |
} |
This file contains hidden or 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 version 52.0 (52) | |
// access flags 0x21 | |
public class Main { | |
// compiled from: Main.java | |
// access flags 0x19 | |
public final static INNERCLASS java/lang/invoke/MethodHandles$Lookup java/lang/invoke/MethodHandles Lookup | |
// access flags 0x1 | |
public <init>()V | |
L0 | |
LINENUMBER 4 L0 | |
ALOAD 0 | |
INVOKESPECIAL java/lang/Object.<init> ()V | |
RETURN | |
L1 | |
LOCALVARIABLE this LMain; L0 L1 0 | |
MAXSTACK = 1 | |
MAXLOCALS = 1 | |
// access flags 0x9 | |
public static main([Ljava/lang/String;)V | |
L0 | |
LINENUMBER 8 L0 | |
GETSTATIC java/lang/System.out : Ljava/io/PrintStream; | |
ICONST_3 | |
ANEWARRAY java/lang/Integer | |
DUP | |
ICONST_0 | |
ICONST_1 | |
INVOKESTATIC java/lang/Integer.valueOf (I)Ljava/lang/Integer; | |
AASTORE | |
DUP | |
ICONST_1 | |
ICONST_2 | |
INVOKESTATIC java/lang/Integer.valueOf (I)Ljava/lang/Integer; | |
AASTORE | |
DUP | |
ICONST_2 | |
ICONST_3 | |
INVOKESTATIC java/lang/Integer.valueOf (I)Ljava/lang/Integer; | |
AASTORE | |
INVOKESTATIC java/util/Arrays.asList ([Ljava/lang/Object;)Ljava/util/List; | |
INVOKEINTERFACE java/util/List.stream ()Ljava/util/stream/Stream; | |
INVOKEDYNAMIC apply()Ljava/util/function/Function; [ | |
// handle kind 0x6 : INVOKESTATIC | |
java/lang/invoke/LambdaMetafactory.metafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; | |
// arguments: | |
(Ljava/lang/Object;)Ljava/lang/Object;, | |
// handle kind 0x6 : INVOKESTATIC | |
Main.lambda$main$0(Ljava/lang/Integer;)Ljava/lang/Integer;, | |
(Ljava/lang/Integer;)Ljava/lang/Integer; | |
] | |
INVOKEINTERFACE java/util/stream/Stream.map (Ljava/util/function/Function;)Ljava/util/stream/Stream; | |
INVOKESTATIC java/util/stream/Collectors.toList ()Ljava/util/stream/Collector; | |
INVOKEINTERFACE java/util/stream/Stream.collect (Ljava/util/stream/Collector;)Ljava/lang/Object; | |
INVOKEVIRTUAL java/io/PrintStream.println (Ljava/lang/Object;)V | |
L1 | |
LINENUMBER 9 L1 | |
RETURN | |
L2 | |
LOCALVARIABLE args [Ljava/lang/String; L0 L2 0 | |
MAXSTACK = 5 | |
MAXLOCALS = 1 | |
// access flags 0x100A | |
private static synthetic lambda$main$0(Ljava/lang/Integer;)Ljava/lang/Integer; | |
L0 | |
LINENUMBER 8 L0 | |
ALOAD 0 | |
INVOKEVIRTUAL java/lang/Integer.intValue ()I | |
ALOAD 0 | |
INVOKEVIRTUAL java/lang/Integer.intValue ()I | |
IMUL | |
INVOKESTATIC java/lang/Integer.valueOf (I)Ljava/lang/Integer; | |
ARETURN | |
L1 | |
LOCALVARIABLE x Ljava/lang/Integer; L0 L1 0 | |
MAXSTACK = 2 | |
MAXLOCALS = 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment