opennlp-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "william.colen@gmail.com" <william.co...@gmail.com>
Subject Re: svn commit: r1159566 - in /incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools: chunker/ namefind/ postag/ sentdetect/ tokenize/ util/eval/
Date Fri, 19 Aug 2011 10:11:18 GMT
On Fri, Aug 19, 2011 at 7:07 AM, Jörn Kottmann <kottmann@gmail.com> wrote:

> On 8/19/11 11:54 AM, colen@apache.org 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

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message