Package Summary Overview Summary

Module java.base
Package java.lang.classfile.instructionPREVIEW

# Interface LookupSwitchInstruction

All Superinterfaces:
  `ClassFileElementPREVIEW`, `CodeElementPREVIEW`, `InstructionPREVIEW`

public sealed interface LookupSwitchInstruction extends InstructionPREVIEW
`LookupSwitchInstruction` is a preview API of the Java platform.
Programs can only use `LookupSwitchInstruction` when preview features are enabled.
Preview features may be removed in a future release, or upgraded to permanent features of the Java platform.
Models a `lookupswitch` instruction in the `code` array of a `Code` attribute. Delivered as a `CodeElement`PREVIEW when traversing the elements of a `CodeModel`PREVIEW.

Since:
  22

- ## Method Summary

  Modifier and Type
  Method
  Description
  `List <SwitchCasePREVIEW>`
  `cases()`
  Returns the cases of the switch.
  `LabelPREVIEW`
  `defaultTarget()`
  Returns the target of the default case.
  `static LookupSwitchInstructionPREVIEW`
  `of (LabelPREVIEW defaultTarget, List<SwitchCasePREVIEW> cases)`
  Returns a lookup switch instruction.

  ### Methods declared in interface java.lang.classfile.InstructionPREVIEW

  `opcode, sizeInBytes`

- ## Method Details

  - ### defaultTarget

    LabelPREVIEW defaultTarget()
    Returns the target of the default case.
    Returns:
      the target of the default case

  - ### cases

    List<SwitchCasePREVIEW> cases()
    Returns the cases of the switch.
    Returns:
      the cases of the switch

  - ### of

    static LookupSwitchInstructionPREVIEW of (LabelPREVIEW defaultTarget, List<SwitchCasePREVIEW> cases)
    Returns a lookup switch instruction.
    Parameters:
      `defaultTarget` - the default target of the switch
      `cases` - the cases of the switch
    Returns:
      a lookup switch instruction