Initialization of List in a JSF Managed bean

后端 未结 5 946
闹比i
闹比i 2020-12-01 13:19

I\' have a question about initialization of List in the POJO as it follows the next code:

public class Person {

 //other fields...
 private List

        
5条回答
  •  借酒劲吻你
    2020-12-01 13:43

    It depends. Usually first way preferable because you may want to add something to collection later. If you won't know was your collection initialized or not you must check it every time.

提交回复
热议问题