Timeline for null values vs "empty" singleton for optional fields
Current License: CC BY-SA 3.0
6 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Nov 23, 2012 at 14:44 | comment | added | Landei |
And you have Option.option2Iterable, so you can use Options in enhanced for-loops.
|
|
| Nov 23, 2012 at 10:50 | comment | added | David Pierre | Using Option core methods isEmpty()/isDefined() and get() works perfectly fine from Java. | |
| Nov 23, 2012 at 10:25 | comment | added | MisterMetaphor |
I'm not sure, but I think you can call Option's isEmpty from Java to check if there's any value (the equivalent to if (object.field() == null) { ... }). But I haven't tried this.
|
|
| Nov 23, 2012 at 10:05 | review | First posts | |||
| Nov 23, 2012 at 10:45 | |||||
| Nov 23, 2012 at 10:03 | comment | added | Uko |
Wow, that's really helpful. I'm also using this code from java app. How will java work with Option[T]? Should I provide some additional methods? Because with null it's simple: if (object.field() != null) {...}
|
|
| Nov 23, 2012 at 9:47 | history | answered | MisterMetaphor | CC BY-SA 3.0 |