Stream.findFirst different than Optional.of?

后端 未结 5 1204
旧时难觅i
旧时难觅i 2021-02-18 19:13

Let\'s say I have two classes and two methods:

class Scratch {
    private class A{}
    private class B extends A{}

    public Optional getItems(List&         


        
5条回答
  •  温柔的废话
    2021-02-18 20:14

    If the class B inherits class A, that doesn't mean Optional inherits Optional. Optional is a different class.

提交回复
热议问题