Home > Back-end >  Java array capacity is enough, if not enough?
Java array capacity is enough, if not enough?

Time:10-11

Java array capacity is enough, if not enough?

CodePudding user response:

Array is fixed, the structure is defined length, inadequate didn't also way,
Use according to actual condition, capacity variable use the List

CodePudding user response:

The length of the array is fixed, before I met this kind of problem, is to use a collection, such as the list collection this way to store data, and finally create data in according to the size of the list,

CodePudding user response:

The length of the array is fixed, before I met this kind of problem, is to use a collection, such as the list collection this way to store data, and finally create an array in according to the length of the list,

CodePudding user response:

2 to the power, 31 should be used, more than abnormal transactions

CodePudding user response:

You use what is enough?
If it is capacity exceeds the maximum limit int? Then their control adopts multi-dimensional array, such as a [] is full, a new b [] []=new xx [Max] []; B [0]=a; B [1]=new xx (Max); Continue to deposit, b [1]
If refers to the length is not enough, the original definition is that a new new an array capacity is enough, then put the old array data copied to the new array,
  • Related