java - How do I check to see if there is space in an array? -


for part of schoolwork need write method goes through array of objects see if there space add object array. if able add object method returns true , if wasn't able add returns false. how check array see if there empty cells in array can add element array? example, have array size of 25 15 cells full , want add object in 1 of ten cells empty or null. add method boolean return value. need know cell can add , need check cell empty or null.

public void isspace(string[] array) {   (int i=0; i<array.length; i++) {     if( (array[i] == null) || (array[i].trim().length() == 0)) {       //true on null, empty string, or white space only. here       array[i] = "add thing here";     }     else {       //not null, not empty string, or not white space. here     }   } } 

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -