Forums Register Login

java Collection question

+Pie Number of slices to send: Send
Hi,

I have a collection which is like {obj1, null, obj3}. This collection is the result of a database query.
when i am trying to access the 2nd object(which is null) i am getting NPE. How can i filter the collection for null values?

Thanks in advance.
+Pie Number of slices to send: Send
do you want to prevent null objects from going into the collection, or when the object is null, avoid getting the NPE?
+Pie Number of slices to send: Send
+Pie Number of slices to send: Send
That was simple! Thanks a lot Minh.
Fire me boy! Cool, soothing, shameless self promotion:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 616 times.
Similar Threads
a garbage collection question from K&B self-test
nullifying an object in a generics list collection
Collections
Vector and null
Collection Storing problem
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 03:36:15.