Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Beginning Java
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Ron McLeod
Liutauras Vilda
Paul Clapham
paul wheaton
Sheriffs:
Tim Cooke
Devaka Cooray
Rob Spoor
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Tim Moores
Carey Brown
Mikalai Zaikin
Bartenders:
Forum:
Beginning Java
Next null in arrays?
Sam Bluesman
Ranch Hand
Posts: 191
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Is there anyway to find the index of the next null value in an array?
Moosey knows best
Keith Lynn
Ranch Hand
Posts: 2412
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Do you mean a way other than a loop that searches through it?
Sam Bluesman
Ranch Hand
Posts: 191
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
I suppose you cold say that yes.
Moosey knows best
Keith Lynn
Ranch Hand
Posts: 2412
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
You could use an ArrayList instead of an array and use indexOf
memati bas
Ranch Hand
Posts: 85
posted 17 years ago
Number of slices to send:
Optional 'thank-you' note:
Send
Hello,
This method can be helpful for you.
public String index(String[] array) { int[] x = new int[array.length]; // maximum capacity int b = 0; String s = ""; for(int a = 0; a < array.length; a++){ if(array[a] == null){ x[b] = a; b++; s = s + a + "\t"; } } return s; }
Please enjoy this holographic presentation of our apocalyptic dilemma right after this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
updation..error..
UB find method - OR or AND
Stop reading when reached the end of file
.showInputDialog()
Rant about java Iterator interface
More...