4. Type-Safe Enum on Android (3)
• 優點
• 可以透過 compile 來提早檢查參數
• JIT compiler and ever-improving Dalvik VM, you don’t
have to worry about that issue and are encouraged to
use type-safe enum in your application code.
• 缺點
• APK 變大
• 配合 Handler 不好使用
7. Enhanced For-Loop on Android (3)
• In the cases where you not only need the value of
each entry but also the position, be sure to use
either an array or an ArrayList because all other
Collection classes are much slower in these
situations.
• In general, if you need high-quality performance
when reading sets of data that rarely change, use a
regular array. However, arrays have a fixed size
and will affect performance when adding data, so
consider all factors when writing your code.
9. Smarter Queues (2)
• LinkedBlockingQueue<String> blockingQueue =
new LinkedBlockingQueue<String>();
• You can find the classes for performing
concurrent programming in the
java.util.concurrent package