RE: Map nullValue to empty collection

2007-02-09 Thread Daniel Pitts
Depending on whether you need to be able to "add/remove" from the Objects list after its set: public void setObjects(List objects) { this.objects = objects == null ? Collections.emptyList() : objects; } // or public void setObjects(List objects) { this.objects = objects == null ? new Arra

Re: Map nullValue to empty collection

2007-02-09 Thread Koka Kiknadze
Maybe instead of throwing exception creating empty list would work for you (I often use it to avoid routine null checks ) public void setObjects(List objects){ if (objects == null) { objects = new ArrayLis(); } this.objects = objects; }