Skip to content

Conversation

@ivamly
Copy link

@ivamly ivamly commented Dec 8, 2025

Implementation of the LANG-1707 suggestion: added the concat methods to ArrayUtils for convenient concatenation of multiple arrays in a single call.

  • Read the contribution guidelines for this project.
  • Read the ASF Generative Tooling Guidance if you use Artificial Intelligence (AI).
  • I used AI to create any part of, or all of, this pull request. Which AI tool was used to create this pull request, and to what extent did it contribute?
  • Run a successful build using the default Maven goal with mvn; that's mvn on the command line by itself.
  • Write unit tests that match behavioral changes, where the tests fail if the changes to the runtime are not applied. This may not always be possible, but it is a best practice.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Each commit in the pull request should have a meaningful subject line and body. Note that a maintainer may squash commits during the merge process.

@ivamly
Copy link
Author

ivamly commented Dec 8, 2025

Hi! This is my first contribution to Apache Commons.
I've started by implementing the concat methods for primitive arrays and their corresponding tests.
I would appreciate verification that I'm on the right track. I'm happy to address any feedback and will gladly add the generic T[] method and its tests once the approach is confirmed.

@ivamly
Copy link
Author

ivamly commented Dec 14, 2025

I'm not entirely sure I understand the question correctly. My implementation was based on the Jira ticket and its comments, where adding these methods was discussed and approved (as I understood it).

Could you please clarify what I might be missing? I'd be happy to adjust the approach if needed.

Copy link
Member

@garydgregory garydgregory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ivamly

I see this could be useful now...

  • Add Javadoc tags @since 3.21.0 on new public and protected methods
  • Remove extra blank lines
  • Short-circuit the totalLength computations to throw an IllegalArgumentException once the value exceeds SAFE_MAX_ARRAY_LENGTH; you'll likely need to use a long as the running total or use Math.addExact().
  • Javadoc: Sentence should end in a period (@param).

@garydgregory
Copy link
Member

Hello @ivamly

Are you still working on this?

@ivamly
Copy link
Author

ivamly commented Jan 21, 2026

Hello @garydgregory! I'll push the changes today.

@ivamly ivamly force-pushed the feature/LANG-1707 branch 3 times, most recently from a33357d to e11de7c Compare January 21, 2026 18:43
@ivamly
Copy link
Author

ivamly commented Jan 21, 2026

@garydgregory done.

@ivamly ivamly force-pushed the feature/LANG-1707 branch from e11de7c to 5b8a06b Compare January 21, 2026 19:55
@ivamly
Copy link
Author

ivamly commented Jan 21, 2026

@garydgregory fix build.

Copy link
Member

@garydgregory garydgregory left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello @ivamly
Are you sure about the length computation? It looks to me like it allows for values > SAFE_MAX_ARRAY_LENGTH but just less than Integer.MAX_VALUE.

@ivamly
Copy link
Author

ivamly commented Jan 22, 2026

Really, you right. Work on it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants