[ 
https://issues.apache.org/jira/browse/LUCENE-2547?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12982519#action_12982519
 ] 

Shai Erera commented on LUCENE-2547:
------------------------------------

bq. However, in my application, I already have Long/Integer and i have to 
unbox/rebox pointlessly.

I didn't dive deep into the details of this issue, but what will someone who 
has only long/int (and not their counter objects) do? Will he need to create a 
Long/Integer out of them?

I think more often than not, people use primitives and not their counter 
objects. I wouldn't want Lucene API to suddenly require me to allocate a Long 
(whether explicitly or by autoboxing) just because someone wanted to avoid 
using primitives ...

My experience with the NumericFields API was very good so far - I didn't find 
it cumbersome or less performing. IMO we should handle primitives at the API 
level wherever we can and use Objects as less as possible.

> minimize autoboxing in NumericField
> -----------------------------------
>
>                 Key: LUCENE-2547
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2547
>             Project: Lucene - Java
>          Issue Type: Improvement
>    Affects Versions: 3.0.2
>            Reporter: Woody Anderson
>            Assignee: Simon Willnauer
>             Fix For: 4.0
>
>         Attachments: LUCENE-2547.patch
>
>
> dicIf you already have a Integer/Long/Double etc. 
> numericField.setLongValue(long) causes an unnecessary auto-unbox.
> actually, since internal to setLongValue there is:
> {code}
> fieldsData = Long.valueOf(value);
> {code}
> then, there is an explicit box anyway, so this makes setLongValue(Long) with 
> an auto-box of long roughly the same as setLongValue(long), but better if you 
> started with a Long.
> Long being replaceable with Integer, Float, Double etc.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to