Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

null problem

 
Nick Lebian
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi!
How can I find out, if the return value of a String method is null?
....
List list=new HashList();
for (int i=1; !this.getParameter("gap"+1).equals(null); i++)
{
System.out.println("While");
String gap=getGaps(this.getParameter("gap"+i));
String[] pointer=gap.split(";");
list.add(pointer);
}
...
But in this case, the for loop doesn't stop.
 
Angel Dobbs-Sciortino
Ranch Hand
Posts: 101
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try this:
for (int i=1; this.getParameter("gap"+1) != null; i++)
Angel
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the return value is the string "null", then it should be checked like this...
for (int i=1; !this.getParameter("gap"+1).equals("null"); i++)
 
Vladas Razas
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Very funny Ko Ko. Stop confusing poor guy.
 
Ko Ko Naing
Ranch Hand
Posts: 3178
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Vladas R.:
Very funny Ko Ko. Stop confusing poor guy.

 
Consider Paul's rocket mass heater.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic