( https://www.youtube.com/watch?v=wbp-3BJWsU8 )
Book: Java puzzlers - Joshua Bloch, Neal Gafter
summary:
- Use new BigDecimal(String), not new BigDecimal(double)
- Don’t assume that map.Entry objects in entrySet iteration are stable
- Beware of catastrophic backtracking when writing regex
- Generics > arrays, don’t ignore compiler warnings!
- Never use raw types in new code - they lose all generic type info
- 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