ScalaにはOption型というプログラムの世界観を変えるような魅力的な型があり、それでnullを回避することができる。*1 詳しくはこちらを参照。 ScalaのOptionステキさについてアツく語ってみる - ゆろよろ日記 Javaでも、ScalaのOption型と似て非なるOption型を作れないかなーと思い、思いつきと勢いでコード書いてみました。まぁ、同じものは作れっこないので、遊びです。本気にしないでくださいw 以下のような感じ、Optionのインターフェイスを作って、実装クラスにSomeとNoneを定義。それぞれにofというファクトリメソッドがあります。 public interface Option<T> { // オプションから値を取得する。 public T get(); // オプションから値を取得するが、値がない場合はdefaultValueを返す。 public T
Apple Footer * Available for Qualified Purchasers only. Qualified Purchasers receive an Apple Gift Card when they purchase an Eligible Product at a Qualifying Location through September 30, 2024. Gift card values may vary by Eligible Product. Only one Apple Gift Card per Eligible Product per Qualified Purchaser. Offer subject to availability. While supplies last. Qualified Purchasers shall receive
This site helps you to learn and master the Java Sound API. You'll find code examples, FAQs and applications. The well-known Java Sound Examples show good usage and best practices for programming the Java Sound API. Many of the examples are minimal and easy to follow. But you'll also find special tricks and more complex stuff. Code is saying more than 1000 words! Well, let's hope that everybody k
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く