Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Apache Commonsに関するお話

Apache Commonsに関するお話

2013-07-27 渋谷Java #2
commons-langについてお話しました。

おや、日付が・・・。

mystelynx

July 27, 2013
Tweet

More Decks by mystelynx

Other Decks in Programming

Transcript

  1. 使用例 public int hashCode() { // you pick a hard-coded,

    //randomly chosen, non-zero, odd number // ideally different for each class return new HashCodeBuilder(17, 37). append(name). append(age). append(smoker). toHashCode(); }
  2. 期待していいの? ループ回数 (回) FastDateFormat (ms) SimpleDateFormat (ms) 100,000 588 590

    1,000,000 2476 2589 SimpleDateFormat s = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss") FastDateFormat f = FastDateFormat.getInstance("yyyy-MM-dd HH:mm:ss") for (int i = 0; i < 100000; i++) { f.parse("2013-07-28 15:00:30"); //s.parse("2013-07-28 15:00:30"); }
  3. try { ... } catch (Exception e) { throw new

    ContextedRuntimeException("Error posting account transaction", e) .addContextValue("Account Number", accountNumber) .addContextValue("Amount Posted", amountPosted) .addContextValue("Previous Balance", previousBalance) } org.apache.commons.lang3.exception.ContextedRuntimeException: java.lang.Exception: Error posting account transaction Exception Context: [1:Account Number=null] [2:Amount Posted=100.00] [3:Previous Balance=-2.17] [4:Transaction Id=94ef1d15-d443-46c4-822b-637f26244899]