开发者

Quickest way of storing a byte array in an array?

开发者 https://www.devze.com 2022-12-20 11:11 出处:网络
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 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, by开发者_如何学JAVAte[]> example = new TreeMap()


private byte[][] example;
example = new byte[][ARRAYS_COUNT];
example[0] = new byte[10];
example[1] = new byte[20];
...


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.


How about byte[][] and resize as appropriate? Not as good as an ArrayList but you banned that...

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号