bugmakerrrrrr opened a new issue, #13761: URL: https://github.com/apache/lucene/issues/13761
### Description The ClassCastEx is thrown when the `IntObjectHashMap.values().toArray()` method is called with a type other than `Object`, and of course the same exception occurs with `CharObjectHashMap` and `LongObjectHashMap`. The issue can be reproduced with the following test. ``` @Test public void testStringMapValues() { IntObjectHashMap<String> map = new IntObjectHashMap<>(); map.put(1, "a"); map.put(2, "b"); map.put(3, "c"); String[] values = map.values().toArray(); } ``` There are several options to fix the issue. 1. change the return value to `Object[]`; 2. mimic the `ArrayList.toArray(T[])` method to pass a `T[]` parameter; 3. replace the `toArray` method with a `asList` method, and return a `List<T>`. IMO, either option 2 or 3 would be acceptable. Any thought? ### Version and environment details _No response_ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org