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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -