Claudenw commented on code in PR #335:
URL:
https://github.com/apache/commons-collections/pull/335#discussion_r1008717823
##########
src/main/java/org/apache/commons/collections4/bloomfilter/HasherCollection.java:
##########
@@ -141,29 +172,16 @@ public boolean forEachIndex(IntPredicate consumer) {
@Override
public int[] asIndexArray() {
- List<int[]> lst = new ArrayList<>();
- int[] count = new int[1];
- /*
- * This method needs to return duplicate indices
- */
- for (Hasher hasher : hashers) {
- int[] ary = hasher.indices(shape).asIndexArray();
- lst.add(ary);
- count[0] += ary.length;
- }
- if (lst.isEmpty()) {
- return new int[0];
- }
- if (lst.size() == 1) {
- return lst.get(0);
- }
- int[] result = new int[count[0]];
- int offset = 0;
- for (int[] ary : lst) {
- System.arraycopy(ary, 0, result, offset, ary.length);
- offset += ary.length;
- }
- return result;
+ int[] result = new
int[shape.getNumberOfHashFunctions()*hashers.size()];
Review Comment:
fixed
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]