めんどくさいのであまり説明書きませんが、まぁ貼りつけたgistの実行結果みてください。 session saveってやるとbuild.sbtのファイル自体がなくても勝手に作ってくれちゃうみたいです。 help コマンド名って打つと全部のコマンドでヘルプ表示されるので、この session のコマンドに限らずみんなそれ読みましょう。 内部実装的には、こんな感じで sbt.Keys.scala に埋めこまれてるので、とにかく暇なときにこのKeys.scalaのソースコード読みましょう。
ScalaとJavaってまぁまぁ見た目は似てて、同じ予約語も多いので、Javaの予約語を、Scalaの視点からみた場合に分類して簡単に解説してみました。分類の方法は独自だし、けっこう雑です。 Scala始めようと思ってるけど、Javaのあの予約語は、Scalaだと同じやつあるの?もしないなら、Scalaの予約語の、どれを使えばいいの? っていうJavaプログラマ向けです。Javaプログラマにこそ、Scalaが普及して欲しいので。 完全に説明するのもめんどくさかったので、説明もなんか雑ですが・・・ 同時に、以前scalaの予約語について書いたものがあるので、こっちも見るとよいかも。*1 だいだいJavaと同じ機能のモノ 特に説明の必要がないほど、ほぼJavaと同じ使い方するものはなにも書いてません。 catch class もちろんclassの定義に使うのは同じです。 が、Javaの場合 C
ネタ元 業務系のJavaプログラマーが知っておくべき10個のBad Partsとその対策 結論から先に言うと、3と10以外は結構直接的にscalaで解決できるというか、javaに比べてscalaの方が便利だとおもいます。*1 あと、元ネタのblogの人はgroovy詳しいみたいですが・・・ groovyとscala比べるとgroovyの方が手軽で便利だったり、scalaのほうが型安全だったり*2いろいろあるかもしれませんが、groovyあまり詳しくないので、その辺の言及というか、比較はやめておきます。*3 1.標準APIのチェック例外が扱いにくい チェック例外ってなにそれおいしいの?(・ω・) java Field field; try { field = getClass().getField("testField"); Object value = field.get(this); }
元コードはの118ページ目 変数多いぅぉ・・・try catchやifが値を返せばretValとかいらないのに・・・ という「Javaコードを見るとscalaで書き直したい病」が発病したので(・ω・`) 元のJavaコード↓ @Override public int compare(Player o1,Player o2) { float o1A, o2A; int retVal; if(o1.getId() == o2.getId()) return 0; if(o1.hasRole(Player.Roles.Batter)){ try{ o1A = o1.asBatter().getAverage(); }catch(NotEnoughAtBatsException e) { o1A = 0.0f; } } else o1A = 0.0f; if(o2.hasRole(Player.R
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く