( https://www.youtube.com/watch?v=wbp-3BJWsU8 )

Book: Java puzzlers - Joshua Bloch, Neal Gafter

summary:

  1. Use new BigDecimal(String), not new BigDecimal(double)
  2. Don’t assume that map.Entry objects in entrySet iteration are stable
  3. Beware of catastrophic backtracking when writing regex
  4. Generics > arrays, don’t ignore compiler warnings!
  5. Never use raw types in new code - they lose all generic type info
  6. Use L for long (not l), never start an int with 0 (makes it octal)

2: new HashSet(map.entrySet()) idiom fails for EnumMap, IdentityHashMap