currently the index a List<int>
can take is Int32, can I go for Int64?
So i can use something like mylist[1000000000000].
You can't make an ArrayList (or for that matter an int[] array) that has a long for its index.
An attempt to access an array component with a long index value results in a compile-time error. If for some reason you have an index stored in a long, just cast it to an int and then index your array. You cannot create an array large enough so it cannot be indexed by an integer in Java.
It is not possible to define an array section using Indexes, but one can use them in gather/scatter-like operations. The only restriction is that elements in an Index must be nonnegative. The same value can appear multiple times in an Index.
No you cannot.
This would not be useful if it was allowed. The CLR has a limit on the maximum size of an object at 2GB. Hence it's not even possible to construct an array where a long
index would be useful.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With