On Fri, Aug 19, 2011 at 7:07 AM, Jörn Kottmann <[email protected]> wrote:
> On 8/19/11 11:54 AM, [email protected] wrote: > >> + public Evaluator(List<? extends EvaluationSampleListener<T>> >> listeners) { >> if(listeners != null) { >> this.listeners = Collections.unmodifiableList(**listeners); >> } >> > > We need to make a copy here, otherwise a user can still modify the list, > the unmodifiableList only prevents the Evaluator object from changing the > List. > Sorry. Should this work? public Evaluator(List<? extends EvaluationSampleListener<T>> listeners) { if(listeners != null) { this.listeners = new LinkedList<EvaluationSampleListener<T>>(listeners); } } thanks
