Reputation: 1212
I was wondering what is the quickest way of storing a byte[]
with an integer index in java without using Maps, TreeMap, ArrayLists etc.
i.e. not like this:
private Map<Integer, byte[]> example = new TreeMap()
Upvotes: 2
Views: 205
Reputation: 1109865
Quickest way would be an ArrayList<byte[]>
, or you want or not. A byte[][]
isn't going to work as you can then hold only 28-1 arrays, not 232-1 as you could with an integer index which you explicitly mentioned in your question.
Upvotes: 1
Reputation: 839254
How about byte[][]
and resize as appropriate? Not as good as an ArrayList
but you banned that...
Upvotes: 0
Reputation: 6255
private byte[][] example;
example = new byte[][ARRAYS_COUNT];
example[0] = new byte[10];
example[1] = new byte[20];
...
Upvotes: 2