The idea was good enough for my original use case, but I'm getting second thoughts about this now. Since Guava's Optional cannot contain null value, I see few options:
Return nullable T (not Optional) and throw an exception when such transform is used on the empty cursor.
Forbid returning null from transforming Function.
Return some other wrapper over T which accepts null values.
The idea was good enough for my original use case, but I'm getting second thoughts about this now. Since Guava's Optional cannot contain null value, I see few options:
Let me know what do you think about this.