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: r1160806 - /incubator/opennlp/trunk/opennlp-tools/src/main/java/opennlp/tools/util/eval/Evaluator.java
Date Tue, 23 Aug 2011 22:33:21 GMT
On Tue, Aug 23, 2011 at 7:13 PM, Jörn Kottmann <kottmann@gmail.com> wrote:

> On 8/23/11 7:06 PM, colen@apache.org wrote:
>
>>    public Evaluator(EvaluationMonitor<T>**... listeners) {
>> -    if(listeners != null) {
>> -      this.listeners = Arrays.asList(listeners);
>> -    }
>> +    this.listeners = listeners;
>>    }
>>
>
> We again need to make a copy here, because an array would just be
> passed by its reference and can be modified afterwards by the caller.
> Because of that the Evaluator object cannot encapsulate it.
>
> Maybe just keep the old list, and copy it into it. Usually you would
> do an array copy, but that is not possible without a warning here ...
>
> Jörn
>

I see. I will have to do the same in each CV tool because there we also keep
a copy of the monitors array.

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