Search icon CANCEL
Subscription
0
Cart icon
Cart
Close icon
You have no products in your basket yet
Save more on your purchases!
Savings automatically calculated. No voucher code required
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Java Lambdas

You're reading from  Learning Java Lambdas

Product type Book
Published in Mar 2017
Publisher
ISBN-13 9781787282087
Pages 114 pages
Edition 1st Edition
Languages
Author (1):
Toby Weston Toby Weston
Profile icon Toby Weston
Toc

Example 3


package jdk8.byte_code;

import static jdk8.byte_code.WaitFor.waitFor;

public class Example3 {
    // simple lambda
    void example() throws InterruptedException {
        waitFor(() -> true);
    }
}
Classfile Example3.class
  Last modified 08-May-2014; size 1155 bytes
  MD5 checksum 22e120de85528efc921bb158588bbaa1
  Compiled from "Example3.java"
public class jdk8.byte_code.Example3
  SourceFile: "Example3.java"
  InnerClasses:
      public static final #50= #49 of #53; //Lookup=class java/lang/invoke/MethodHandles$Lookup of class java/lang/invoke/MethodHandles
  BootstrapMethods:
    0: #23 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;
  Method arguments:
    #24 ()Ljava/lang/Boolean;
    #25 invokestatic jdk8/byte_code/Example3.lambda$example$25:()Ljava/lang/Boolean;
    #24 ()Ljava/lang/Boolean;
  minor version: 0
  major version: 52
  flags: ACC_PUBLIC, ACC_SUPER
Constant pool:
 #1 = Methodref        #6.#21    // java/lang/Object."<init>":()V
 #2 = InvokeDynamic    #0:#26    // #0:isSatisfied:()Ljdk8/byte_code/Condition; 
 #3 = Methodref        #27.#28   // jdk8/byte_code/WaitFor.waitFor:(Ljdk8/byte_code/Condition;)V 
 #4 = Methodref        #29.#30   // java/lang/Boolean.valueOf:(Z)Ljava/lang/Boolean; 
 #5 = Class            #31       // jdk8/byte_code/Example3 
 #6 = Class            #32       // java/lang/Object 
 #7 = Utf8             <init> 
 #8 = Utf8             ()V 
 #9 = Utf8             Code 
 #10 = Utf8            LineNumberTable 
 #11 = Utf8            LocalVariableTable 
 #12 = Utf8            this 
 #13 = Utf8            Ljdk8/byte_code/Example3; 
 #14 = Utf8            example 
 #15 = Utf8            Exceptions 
 #16 = Class           #33       // java/lang/InterruptedException 
 #17 = Utf8            lambda$example$25 
 #18 = Utf8            ()Ljava/lang/Boolean; 
 #19 = Utf8            SourceFile 
 #20 = Utf8            Example3.java 
 #21 = NameAndType     #7:#8     // "<init>":()V 
 #22 = Utf8            BootstrapMethods 
 #23 = MethodHandle    #6:#34    // 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; 
 #24 = MethodType      #18       // ()Ljava/lang/Boolean;
 #25 = MethodHandle    #6:#35    // invokestatic jdk8/byte_code/Example3.lambda$example$25:()Ljava/lang/Boolean; 
 #26 = NameAndType     #36:#37   // isSatisfied:()Ljdk8/byte_code/Condition;     
 #27 = Class           #38       // jdk8/byte_code/WaitFor 
 #28 = NameAndType     #39:#40   // waitFor:(Ljdk8/byte_code/Condition;)V 
 #29 = Class           #41       // java/lang/Boolean 
 #30 = NameAndType     #42:#43   // valueOf:(Z)Ljava/lang/Boolean; 
 #31 = Utf8            jdk8/byte_code/Example3 
 #32 = Utf8            java/lang/Object
 #33 = Utf8            java/lang/InterruptedException 
 #34 = Methodref       #44.#45   // 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; 
 #35 = Methodref       #5.#46    // jdk8/byte_code/Example3.lambda$example$25:()Ljava/lang/Boolean; 
 #36 = Utf8            isSatisfied 
 #37 = Utf8            ()Ljdk8/byte_code/Condition;
 #38 = Utf8            jdk8/byte_code/WaitFor
 #39 = Utf8            waitFor
 #40 = Utf8            (Ljdk8/byte_code/Condition;)V 
 #41 = Utf8            java/lang/Boolean 
 #42 = Utf8            valueOf 
 #43 = Utf8            (Z)Ljava/lang/Boolean;
 #44 = Class           #47       // java/lang/invoke/LambdaMetafactory    
 #45 = NameAndType     #48:#52   // 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; 
 #46 = NameAndType     #17:#18  // lambda$example$25:()Ljava/lang/Boolean;  
 #47 = Utf8            java/lang/invoke/LambdaMetafactory 
 #48 = Utf8            metafactory 
 #49 = Class           #54      // java/lang/invoke/MethodHandles$Lookup 
 #50 = Utf8            Lookup 
 #51 = Utf8            InnerClasses 
 #52 = Utf8 (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; 
 #53 = Class           #55        // java/lang/invoke/MethodHandles
 #54 = Utf8            java/lang/invoke/MethodHandles$Lookup 
 #55 = Utf8            java/lang/invoke/MethodHandles 
{ 
public jdk8.byte_code.Example3();
 descriptor: ()V
 flags: ACC_PUBLIC
 Code:
  stack=1, locals=1, args_size=1
    0: aload_0
    1: invokespecial #1           // Method java/lang/Object."<init>":()V 
    4: return
 LineNumberTable:
 line 6: 0
 LocalVariableTable:
 Start Length Slot Name Signature
     0      5    0 this Ljdk8/byte_code/Example3;
void example() throws java.lang.InterruptedException;
    descriptor: ()V
    flags:
    Code:
      stack=1, locals=1, args_size=1
         0: invokedynamic #2,  0    // InvokeDynamic #0:isSatisfied:()Ljdk8/byte_code/Condition;
         5: invokestatic  #3       // Method jdk8/byte_code/WaitFor.waitFor:(Ljdk8/byte_code/Condition;)V
         8: return
      LineNumberTable:
        line 10: 0
        line 11: 8
      LocalVariableTable:
        Start  Length  Slot  Name   Signature
            0       9     0  this   Ljdk8/byte_code/Example3;
    Exceptions:
      throws java.lang.InterruptedException
}
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime