[
https://issues.apache.org/jira/browse/LUCENE-10403?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17486756#comment-17486756
]
Greg Miller commented on LUCENE-10403:
--------------------------------------
For what it's worth, I recently narrowly avoided an off-by-one issue by
providing the current length of the array as the min size instead of the
current size + 1. Fully realize this is a user-error on my part, but having
this method that doesn't require the user to provide a min size would have been
nice in the real-world use-case I had.
> Add ArrayUtil#grow(T[])
> -----------------------
>
> Key: LUCENE-10403
> URL: https://issues.apache.org/jira/browse/LUCENE-10403
> Project: Lucene - Core
> Issue Type: Improvement
> Components: core/other
> Reporter: Greg Miller
> Priority: Minor
> Time Spent: 10m
> Remaining Estimate: 0h
>
> {{ArrayUtil}} exposes convenience methods for all primitive array types that
> don't require the user to provide a min size (defaulting to the current array
> length + 1 as the min size). It would be nice to include the same paradigm
> for the generically-typed version.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]