You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am new to agrona and tried to feel the usage of IntArrayList. Below is what I tried:
int[] a = new int[]{1,2,3};
IntArrayList ial = new IntArrayList();
ial.wrap(a, a.length);
Of cause this code complains about illegal initial array length 3, minimum required is 10.
I read the code and I can see how this happens. What I don't understand are:
why do I need to provide initial size to wrap an existing int array? since it can be figured out by a.length.
why can't I wrap a int array less than 10 elements? since IMHO the requirements to capacity are to be big enough to contain the data and to auto increase/decrease on demand.
Anything I missed here? Looking forward to the rationale.
The text was updated successfully, but these errors were encountered:
It was a pragmatic lower bound and having to deal with a special case of a zero length array when resizing. It is all that was required for our use. I've made it more flexible with the latest change.
Hi there,
I am new to agrona and tried to feel the usage of IntArrayList. Below is what I tried:
Of cause this code complains about
illegal initial array length 3, minimum required is 10
.I read the code and I can see how this happens. What I don't understand are:
a.length
.Anything I missed here? Looking forward to the rationale.
The text was updated successfully, but these errors were encountered: