Created
July 22, 2014 18:11
-
-
Save alalwww/91a9e6651fbc63b2fb71 to your computer and use it in GitHub Desktop.
PlayのOptionはItelable実装してるので、判定と代入がforで書けちゃう
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
F.Option<Value> valueOrNull = findOptionValue(); | |
// valueがあったら更新して返す | |
for (Value val : valueOrNull) { | |
val.update(); | |
return val; | |
} | |
// valueがなかったらあたらしく作って初期化して保存して返す | |
Value newValue = new Value(); | |
newValue.initialize(); | |
newValue.save(); | |
return newValue; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment