Skip to content

Conversation

@vsop-479
Copy link
Contributor

Description

Discussed in #14770.

@vsop-479
Copy link
Contributor Author

Hello, @uschindler
There is a little difference between two versions on the calculation fo capacity: the old one divide by 0.75f, and add one. Now , we just divide 0.75f.

@vsop-479 vsop-479 requested a review from uschindler December 23, 2025 09:05
@uschindler
Copy link
Contributor

Hi,
The plan was to remove both methods in main branch and replace the whole code by the default variant I n JDK.

The plus1 issue comes from a safety added, I think because @thecoop wanted to make sure that after rounding the size is correct. According to JDK docs the newHashXxx method in jdk ensures that the requested elements fit into the map without resizing. So they .ay gave changed other stuff to make the plus1 not needed.

Uwe

@thecoop
Copy link
Contributor

thecoop commented Dec 23, 2025

Yup, these CollectionUtil methods can just be removed and the JCL methods used directly. There'll need to be a changelog entry documenting the API removal. CollectionUtil is marked as internal, so we can just remove these for Lucene 11

@vsop-479
Copy link
Contributor Author

Thanks @uschindler, @thecoop.

I considered use the JDK methods directly, but chosed this way.

Anyway, I will fix it.

@github-actions github-actions bot added this to the 11.0.0 milestone Dec 24, 2025
@vsop-479 vsop-479 changed the title Use HashMap#newHashMap, HashSet#newHashSet in CollectionUtil. Use HashMap#newHashMap, HashSet#newHashSet instead of CollectionUtil#newHashMap, CollectionUtil#newHashSet. Dec 24, 2025
@vsop-479
Copy link
Contributor Author

Hi @uschindler , @thecoop
I removed CollectionUtil#newHashMap, CollectionUtil#newHashSet, and use Use HashMap#newHashMap, HashSet#newHashSet directly.

This pr also plus 1 for CustomAnalyzer#paramsToMap 's map size.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants