What is the proper way for avoiding NullPointerException of a collection in an object?

前端 未结 0 1217
挽巷
挽巷 2020-12-18 13:38

I have an entity coded as below:

public class User {
//user id and properties

private Set elements = new HashSet<>();

//getters, setter         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题