Effective Java By Joshua Bloch: Item1 - Static Factory Method

后端 未结 6 614
猫巷女王i
猫巷女王i 2020-12-13 05:20

I am reading the Effective Java by Joshua Bloch and I have question about Item1 Static Factory Method.

Quote[Bloch, p.7]<

6条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-13 05:50

    1) I don't understand your question here. Collection is the interface and Collections has some factory methods like emptyList

    2) E.g the List instance that is returned by Collection.emptyList is an instance of a private class that implements the List interface.

提交回复
热议问题