java - Sort array containing null elements -


this question has answer here:

i have string array of size 1000:

string[] substrstore = new string[1000]; 

i have 6 elements in array. if sort using:

arrays.sort(substrstore); 

i getting null pointer exception because tries compare null elements. how can solve problem?

if strings first 6 elements can use

arrays.sort(substrstore, 0, 6); 

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 -