Pattern Matching in Java by Venkat Subramaniam

Поділитися
Вставка
  • Опубліковано 17 лис 2024

КОМЕНТАРІ • 4

  • @RickGladwin
    @RickGladwin 6 місяців тому +3

    I’m a simple man. I see a Venkat Subramaniam video, I click it.

  • @machindrakarpe7498
    @machindrakarpe7498 6 місяців тому +1

    I admire you a lot, always excited for your new videos

  • @RickGladwin
    @RickGladwin 6 місяців тому

    Around 52:40, the use of `sealed` without `permits` is really clean, but how/when does the compiler determine that `Sell` and `Buy` are the only two entities implementing `Trade`? Or if the compiler keeps track of everything that implements `Trade` whether `Trade` is sealed or not, does the `sealed` modifier just tell it to treat that set as complete, for the purposes of things like pattern matching?

    • @0equalsTo1
      @0equalsTo1 3 місяці тому

      If we define permitted subclasses in the same file as the sealed interface | class, then we can omit permits clause.