Question: I have a result object like:

```
public class ActionResult {
   int ...
   String ...
   Boolean ..
}

```

And my method:

```
public ActionResult getAbc(..) {

   String string1;
   Boolean bool1;
   int int1;

   string1 = someDao.get(p1);

   if(string1 != null) {
       bool1 = someDao.getB(string1);
   }

}

```

Now I want to replace this with my `ActionResult` object, but finding it looks messy and I have to convert the values, but the value may be null and my set calls will fail then correct?

Example:

```
if(result.getString1() != null) {
    result.setBool1( someDao.getB1(result.getString1()) );
}

```

The problem is, the result of calling `getB1` actually returns a string (3rd party lib I can't change that), that I then have to cast to a boolean.

```
result.setBool1( Boolean.parseBoolean( someDao.getB1(result.getString1()) ) );

```

Also, the call to `getB1` may return null, now what?
It just seems the code looks very messy and hard to read don't you think?

Answer: 
Two ways to treat null:

1. Consider null as either true or false depend on your problem domain;
2. leave null as null, which simply undetermined.
You have to decide what happens when your library returns `null` One pattern if it is a string is to compare it with true.

```
"true".equalsCaseIgnore(valueWhichCouldBeNull)

```

like equals, if the value is null, it returns false. You have to decide if this is correct. Should it be true or throw an exception (which what exception should it be?)