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

Eliminating Code Overhead (Square HQ 2015)

Eliminating Code Overhead (Square HQ 2015)

The CPU, RAM, and disk are finite resources that are often taken for granted as unbounded. Not only is this obviously untrue, but the use of these resources directly affects the most important resource on a mobile device: the battery. This talk will focus on techniques that both libraries and applications can implement to ensure their effect is in general without overhead.

Video: https://youtu.be/b6zKBZcg5fk

Jake Wharton

June 25, 2015
Tweet

More Decks by Jake Wharton

Other Decks in Programming

Transcript

  1. CPU

  2. • Do not nest multi-pass layouts • Lazily compute complex

    data when needed • Cache heavy computational results for re-use • Consider RenderScript for performance • Keep work off of the main thread Memory CPU I/O
  3. • Use object pools and caches to reduce churn •

    Be mindful of the overhead of enums • Do not allocate inside the draw path • Use specialized collections instead of JDK collections when appropriate (SparseArray) Memory CPU I/O
  4. Memory CPU I/O • Batch operations with reasonable back-off policies

    • Use gzip or binary serialization format • Cache data offline with TTLs for reloading • Use JobScheduler API to batch across OS
  5. I/O Memory CPU What's next after macro? • Move on

    to so-called micro • Spectrum of optimizations, not binary
  6. I/O Memory CPU What's next after macro? • Move on

    to so-called micro • Spectrum of optimizations, not binary • Do not blindly apply to everything, only when appropriate
  7. I/O Memory CPU What's next after macro? • Move on

    to so-called micro • Spectrum of optimizations, not binary • Do not blindly apply to everything, only when appropriate • Multiple micro-optimizations can improve like a macro
  8. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  9. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  10. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  11. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  12. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  13. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  14. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  15. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  16. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  17. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  18. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  19. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  20. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  21. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  22. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  23. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  24. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  25. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  26. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  27. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  28. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  29. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  30. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  31. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  32. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  33. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  34. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  35. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  36. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  37. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  38. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  39. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  40. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  41. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  42. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  43. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  44. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  45. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  46. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  47. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  48. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  49. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  50. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  51. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  52. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  53. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  54. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  55. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  56. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  57. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  58. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  59. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  60. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }
 return unmodifiableList(names);
 }
  61. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>();


    for (User user : users) {
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  62. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>(users.size());


    for (User user : users) {
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  63. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>(users.size());


    for (User user : users) {
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  64. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>(users.size());


    for (User user : users) {
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  65. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X
  66. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X
  67. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X
  68. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X
  69. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X
  70. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X
  71. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty
  72. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty
  73. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty
  74. Jimmy•McNulty public String names(List<User> users) {
 StringBuilder builder = new

    StringBuilder();
 for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X
  75. Jimmy•McNulty public String names(List<User> users) {
 StringBuilder builder = new

    StringBuilder();
 for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty,•
  76. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty,• Jimmy•McNulty,•
  77. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty,• Stringer•Bell Jimmy•McNulty,•
  78. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty,• Stringer•Bell Jimmy•McNulty,•
  79. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty,• Stringer•Bell Jimmy•McNulty,•
  80. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Stringer•Bell Jimmy•McNulty,•
  81. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Stringer•Bell Jimmy•McNulty,•
  82. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Stringer•Bell Jimmy•McNulty,•
  83. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty,•Stringer•Bell
  84. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty,•Stringer•Bell
  85. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty,•Stringer•Bell
  86. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty,•Stringer•Bell Jimmy•McNulty,•Stringer•Bell,•
  87. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty,•Stringer•Bell,• Jimmy•McNulty,•Stringer•Bell,•
  88. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty,•Stringer•Bell,• Bunk•Moreland Jimmy•McNulty,•Stringer•Bell,•
  89. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty,•Stringer•Bell,• Bunk•Moreland Jimmy•McNulty,•Stringer•Bell,•
  90. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty,•Stringer•Bell,• Bunk•Moreland Jimmy•McNulty,•Stringer•Bell,•
  91. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Bunk•Moreland Jimmy•McNulty,•Stringer•Bell,•
  92. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Bunk•Moreland Jimmy•McNulty,•Stringer•Bell,•
  93. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Bunk•Moreland Jimmy•McNulty,•Stringer•Bell,•
  94. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty,•Stringer•Bell,•Bunk•Moreland
  95. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty,•Stringer•Bell,•Bunk•Moreland
  96. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty,•Stringer•Bell,•Bunk•Moreland
  97. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty,•Stringer•Bell,•Bunk•Moreland Jimmy•McNulty,•Stringer•Bell,•Bunk•Moreland,•
  98. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty,•Stringer•Bell,•Bunk•Moreland,•
  99. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X Jimmy•McNulty,•Stringer•Bell,•Bunk•Moreland,• Jimmy•McNulty,•Stringer•Bell,•Bunk•Moreland,•D'Angelo•Barksdale
  100. Jimmy•McNulty,•Stringer•Bell,•Bunk•Moreland,•D'Angelo•Barksdale public String names(List<User> users) {
 StringBuilder builder = new

    StringBuilder();
 for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X
  101. public String names(List<User> users) {
 StringBuilder builder = new StringBuilder();


    for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X
  102. public String names(List<User> users) {
 int avg = 17; //

    Determined by exact science.
 StringBuilder builder = new StringBuilder(avg * users.size());
 for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X
  103. public String names(List<User> users) {
 int avg = 17; //

    Determined by exact science.
 StringBuilder builder = new StringBuilder(avg * users.size());
 for (User user : users) {
 if (builder.length() > 0) builder.append(", ");
 builder.append(user.name);
 }X
 return builder.toString();
 }X
  104. for (int x = 0; x < valueCount; x++) {


    cleanFiles[x] = new File(directory, key + "." + x);
 dirtyFiles[x] = new File(directory, key + "." + x + ".tmp");
 }X
  105. for (int x = 0; x < valueCount; x++) {


    StringBuilder b1 = new StringBuilder();
 b1.append(key);
 b1.append(".");
 b1.append(x);
 cleanFiles[x] = new File(directory, b1.toString());
 StringBuilder b2 = new StringBuilder();
 b2.append(key);
 b2.append(".");
 b2.append(x);
 b2.append(".tmp");
 dirtyFiles[x] = new File(directory, b2.toString());
 }X
  106. for (int x = 0; x < valueCount; x++) {


    StringBuilder b1 = new StringBuilder();
 b1.append(key);
 b1.append(".");
 b1.append(x);
 cleanFiles[x] = new File(directory, b1.toString());
 StringBuilder b2 = new StringBuilder();
 b2.append(key);
 b2.append(".");
 b2.append(x);
 b2.append(".tmp");
 dirtyFiles[x] = new File(directory, b2.toString());
 }X
  107. for (int x = 0; x < valueCount; x++) {


    StringBuilder b = new StringBuilder();
 b.append(key);
 b.append(".");
 b.append(x);
 cleanFiles[x] = new File(directory, b.toString());
 b.append(".tmp");
 dirtyFiles[x] = new File(directory, b.toString());
 }X
  108. for (int x = 0; x < valueCount; x++) {


    StringBuilder b = new StringBuilder();
 b.append(key);
 b.append(".");
 b.append(x);
 cleanFiles[x] = new File(directory, b.toString());
 b.append(".tmp");
 dirtyFiles[x] = new File(directory, b.toString());
 }X
  109. StringBuilder b = new StringBuilder();
 b.append(key);
 b.append("."); for (int x

    = 0; x < valueCount; x++) {
 b.append(x);
 cleanFiles[x] = new File(directory, b.toString());
 b.append(".tmp");
 dirtyFiles[x] = new File(directory, b.toString());
 }X
  110. StringBuilder b = new StringBuilder();
 b.append(key);
 b.append("."); for (int x

    = 0; x < valueCount; x++) {
 b.append(x);
 cleanFiles[x] = new File(directory, b.toString());
 b.append(".tmp");
 dirtyFiles[x] = new File(directory, b.toString());
 }X
  111. StringBuilder b = new StringBuilder();
 b.append(key);
 b.append("."); int truncateTo =

    b.length(); for (int x = 0; x < valueCount; x++) {
 b.append(x);
 cleanFiles[x] = new File(directory, b.toString());
 b.append(".tmp");
 dirtyFiles[x] = new File(directory, b.toString());
 }X
  112. StringBuilder b = new StringBuilder();
 b.append(key);
 b.append("."); int truncateTo =

    b.length(); for (int x = 0; x < valueCount; x++) {
 b.append(x);
 cleanFiles[x] = new File(directory, b.toString());
 b.append(".tmp");
 dirtyFiles[x] = new File(directory, b.toString());
 }X
  113. StringBuilder b = new StringBuilder();
 b.append(key);
 b.append("."); int truncateTo =

    b.length(); for (int x = 0; x < valueCount; x++) {
 b.append(x);
 cleanFiles[x] = new File(directory, b.toString());
 b.append(".tmp");
 dirtyFiles[x] = new File(directory, b.toString()); b.setLength(truncateTo);
 }X
  114. StringBuilder b = new StringBuilder();
 b.append(key);
 b.append("."); int truncateTo =

    b.length(); for (int x = 0; x < valueCount; x++) {
 b.append(x);
 cleanFiles[x] = new File(directory, b.toString());
 b.append(".tmp");
 dirtyFiles[x] = new File(directory, b.toString()); b.setLength(truncateTo);
 }X
  115. StringBuilder b = new StringBuilder(key.length() + 6);
 b.append(key);
 b.append("."); int

    truncateTo = b.length(); for (int x = 0; x < valueCount; x++) {
 b.append(x);
 cleanFiles[x] = new File(directory, b.toString());
 b.append(".tmp");
 dirtyFiles[x] = new File(directory, b.toString()); b.setLength(truncateTo);
 }X
  116. StringBuilder b = new StringBuilder(key.length() + 6);
 b.append(key);
 b.append("."); int

    truncateTo = b.length(); for (int x = 0; x < valueCount; x++) {
 b.append(x);
 cleanFiles[x] = new File(directory, b.toString());
 b.append(".tmp");
 dirtyFiles[x] = new File(directory, b.toString()); b.setLength(truncateTo);
 }X
  117. StringBuilder b = new StringBuilder(key);
 b.append("."); int truncateTo = b.length();

    for (int x = 0; x < valueCount; x++) {
 b.append(x);
 cleanFiles[x] = new File(directory, b.toString());
 b.append(".tmp");
 dirtyFiles[x] = new File(directory, b.toString()); b.setLength(truncateTo);
 }X
  118. StringBuilder b = new StringBuilder(key);
 b.append("."); int truncateTo = b.length();

    for (int x = 0; x < valueCount; x++) {
 b.append(x);
 cleanFiles[x] = new File(directory, b.toString());
 b.append(".tmp");
 dirtyFiles[x] = new File(directory, b.toString()); b.setLength(truncateTo);
 }X
  119. StringBuilder b = new StringBuilder(key);
 b.append("."); int truncateTo = b.length();

    for (int x = 0; x < valueCount; x++) {
 b.append(x);
 cleanFiles[x] = new File(directory, b.toString());
 b.append(".tmp");
 dirtyFiles[x] = new File(directory, b.toString()); public StringBuilder(String str) Constructs a string builder initialized to the contents of the specified string. The initial capacity of the string builder is 16 plus the length of the string argument.
  120. StringBuilder b = new StringBuilder(key);
 b.append("."); int truncateTo = b.length();

    for (int x = 0; x < valueCount; x++) {
 b.append(x);
 cleanFiles[x] = new File(directory, b.toString());
 b.append(".tmp");
 dirtyFiles[x] = new File(directory, b.toString()); public StringBuilder(String str) Constructs a string builder initialized to the contents of the specified string. The initial capacity of the string builder is 16 plus the length of the string argument.
  121. StringBuilder b = new StringBuilder(key);
 b.append("."); int truncateTo = b.length();

    for (int x = 0; x < valueCount; x++) {
 b.append(x);
 cleanFiles[x] = new File(directory, b.toString());
 b.append(".tmp");
 dirtyFiles[x] = new File(directory, b.toString()); b.setLength(truncateTo);
 }X
  122. StringBuilder b = new StringBuilder(key).append("."); int truncateTo = b.length(); for

    (int x = 0; x < valueCount; x++) {
 b.append(x);
 cleanFiles[x] = new File(directory, b.toString()); b.append(".tmp");
 dirtyFiles[x] = new File(directory, b.toString()); b.setLength(truncateTo);
 }X public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>(users.size());
 for (User user : users) {
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  123. private int headerOffset;
 private int headerTop;
 private int animationHeight;
 


    @Override protected void onCreate(Bundle bundle) {
 super.onCreate(bundle);
 
 setTitle(getResources().getString(R.id.title));
 getWindow().setStatusBarColor(getResources().getColor(R.color.blue));
 
 headerOffset = getResources() .getDimensionPixelSize(R.dimen.header_offset);
 headerTop = getResources() .getDimensionPixelSize(R.dimen.header_top);
 animationHeight = getResources() .getDimensionPixelSize(R.dimen.animation_height);
 }X
  124. private int headerOffset;
 private int headerTop;
 private int animationHeight;
 


    @Override protected void onCreate(Bundle bundle) {
 super.onCreate(bundle);
 Resources res = getResources();
 
 setTitle(getResources().getString(R.id.title));
 getWindow().setStatusBarColor(getResources().getColor(R.color.blue));
 
 headerOffset = getResources() .getDimensionPixelSize(R.dimen.header_offset);
 headerTop = getResources() .getDimensionPixelSize(R.dimen.header_top);
 animationHeight = getResources() .getDimensionPixelSize(R.dimen.animation_height);
 }X
  125. private int headerOffset;
 private int headerTop;
 private int animationHeight;
 


    @Override protected void onCreate(Bundle bundle) {
 super.onCreate(bundle);
 Resources res = getResources();
 
 setTitle(res.getString(R.id.title));
 getWindow().setStatusBarColor(res.getColor(R.color.blue));
 
 headerOffset = res.getDimensionPixelSize(R.dimen.header_offset);
 headerTop = res.getDimensionPixelSize(R.dimen.header_top);
 animationHeight = res.getDimensionPixelSize(R.dimen.animation_height);
 }X
  126. private int headerOffset;
 private int headerTop;
 private int animationHeight;
 


    @Override protected void onCreate(Bundle bundle) {
 super.onCreate(bundle);
 Resources res = getResources();
 
 setTitle(res.getString(R.id.title));
 getWindow().setStatusBarColor(res.getColor(R.color.blue));
 
 headerOffset = res.getDimensionPixelSize(R.dimen.header_offset);
 headerTop = res.getDimensionPixelSize(R.dimen.header_top);
 animationHeight = res.getDimensionPixelSize(R.dimen.animation_height);
 }
  127. public boolean validIndices(int[] indices, String string) {
 for (int index

    : indices) {
 if (index < 0 && index >= string.length()) {
 return false;
 }X
 }X
 return true;
 }X
  128. public boolean validIndices(int[] indices, String string) {
 int len =

    string.length();
 for (int index : indices) {
 if (index < 0 && index >= len) {
 return false;
 }X
 }X
 return true;
 }X
  129. public boolean validIndices(int[] indices, String string) {
 int len =

    string.length();
 for (int index : indices) {
 if (index < 0 && index >= len) {
 return false;
 }X
 }X
 return true;
 }X
  130. public boolean firstShorterThan(List<String> strings, int max) {
 for (int i

    = 0; i < strings.size(); i++) {
 if (strings.get(i).length() > max) {
 return i;
 }X
 }X
 return -1;
 }X
  131. public boolean firstShorterThan(List<String> strings, int max) {
 int i =

    0;
 while (i < strings.size()) {X
 if (strings.get(i).length() > max) {Y
 return i;
 }X
 i++;
 }X
 return -1;
 }X
  132. public boolean firstShorterThan(List<String> strings, int max) {
 int i =

    0;
 while (true) {X
 if (!(i < strings.size())) {
 break;
 }Y
 if (strings.get(i).length() > max) {Y
 return i;
 }X
 i++;
 }X
 return -1;
 }X
  133. public boolean firstShorterThan(List<String> strings, int max) {
 for (int i

    = 0;ciy<sstrings.size();xi++) {
 if (strings.get(i).length() > max) {
 return i;
 }X
 }X
 return -1;
 }X
  134. public boolean firstShorterThan(List<String> strings, int max) {
 int size =sstrings.size();

    for (int i = 0;ciy< size;xi++) {
 if (strings.get(i).length() > max) {
 return i;
 }X
 }X
 return -1;
 }X
  135. public boolean firstShorterThan(List<String> strings, int max) {
 int size =sstrings.size();

    for (int i = 0;ciy< size;xi++) {
 if (strings.get(i).length() > max) {
 return i;
 }X
 }X
 return -1;
 }X
  136. public boolean firstShorterThan(List<String> strings, int max) {
 for (int i

    = 0, size = strings.size();ciy< size;xi++) {
 if (strings.get(i).length() > max) {
 return i;
 }X
 }X
 return -1;
 }X
  137. public boolean firstShorterThan(List<String> strings, int max) {
 for (int i

    = 0, size = strings.size();ciy< size;xi++) {
 if (strings.get(i).length() > max) {
 return i;
 }X
 }X
 return -1;
 }X
  138. invokestatic static methods class Test {
 public static void main(String...

    args) {
 staticMethod();
 } 
 public static void staticMethod() {
 System.out.println("Hello, static method!");
 }
 }
  139. invokestatic static methods invokespecial constructors private methods super methods Test();

    Code: 0: aload_0 1: invokespecial #1 // Method java/lang/Object."<init>":()V 4: return
  140. invokestatic static methods invokespecial constructors private methods super methods invokevirtual

    other class methods class Test {
 public static void main(String... args) {
 new Test().method();
 }
 
 public void method() {
 System.out.println("Hello, method!");
 }
 }
  141. invokestatic static methods invokespecial constructors private methods super methods invokevirtual

    other class methods public static void main(java.lang.String...); Code: ... 8: aload_1 9: invokevirtual #4 // Method method:()V
  142. invokestatic static methods invokespecial constructors private methods super methods invokevirtual

    other class methods invokeinterface interface methods class Test {
 public static void main(String... args) {
 List<String> names = Arrays.asList("Alice", "Bob", "Eve");
 int size = names.size();
 System.out.println(size);
 }
 }
  143. invokestatic static methods invokespecial constructors private methods super methods invokevirtual

    other class methods invokeinterface interface methods public static void main(java.lang.String...); Code: ... 23: aload_1 24: invokeinterface #7, 1 // InterfaceMethod java/util/List.size:()I
  144. public class MyActivity extends Activity { @Override protected void onCreate(Bundle

    bundle) {
 super.onCreate(bundle);
 Resources res = getResources(); // ...
 }X @Override public String toString() {
 return "MyActivity";
 }X }X
  145. public class MyActivity extends Activity { @Override protected void onCreate(Bundle

    bundle) {
 super.onCreate(bundle);
 Resources res = getResources(); // ...
 }X @Override public String toString() {
 return "MyActivity";
 }X }X Method Address
  146. public class MyActivity extends Activity { @Override protected void onCreate(Bundle

    bundle) {
 super.onCreate(bundle);
 Resources res = getResources(); // ...
 }X @Override public String toString() {
 return "MyActivity";
 }X }X Method Address MyActivity Activity ContextThemeWrapper Context Object
  147. public class MyActivity extends Activity { @Override protected void onCreate(Bundle

    bundle) {
 super.onCreate(bundle);
 Resources res = getResources(); // ...
 }X @Override public String toString() {
 return "MyActivity";
 }X }X Method Address MyActivity Activity ContextThemeWrapper Context Object
  148. public class MyActivity extends Activity { @Override protected void onCreate(Bundle

    bundle) {
 super.onCreate(bundle);
 Resources res = getResources(); // ...
 }X @Override public String toString() {
 return "MyActivity";
 }X }X Method Address Object.toString 101 MyActivity Activity ContextThemeWrapper Context Object
  149. public class MyActivity extends Activity { @Override protected void onCreate(Bundle

    bundle) {
 super.onCreate(bundle);
 Resources res = getResources(); // ...
 }X @Override public String toString() {
 return "MyActivity";
 }X }X Method Address Object.toString 101 Object.hashCode 102 MyActivity Activity ContextThemeWrapper Context Object
  150. public class MyActivity extends Activity { @Override protected void onCreate(Bundle

    bundle) {
 super.onCreate(bundle);
 Resources res = getResources(); // ...
 }X @Override public String toString() {
 return "MyActivity";
 }X }X Method Address Object.toString 101 Object.hashCode 102 ... MyActivity Activity ContextThemeWrapper Context Object
  151. Method Address Object.toString 101 Object.hashCode 102 ... public class MyActivity

    extends Activity { @Override protected void onCreate(Bundle bundle) {
 super.onCreate(bundle);
 Resources res = getResources(); // ...
 }X @Override public String toString() {
 return "MyActivity";
 }X }X MyActivity Activity ContextThemeWrapper Context Object
  152. Method Address Object.toString 101 Object.hashCode 102 Context.getResources 201 ... public

    class MyActivity extends Activity { @Override protected void onCreate(Bundle bundle) {
 super.onCreate(bundle);
 Resources res = getResources(); // ...
 }X @Override public String toString() {
 return "MyActivity";
 }X }X MyActivity Activity ContextThemeWrapper Context Object
  153. public class MyActivity extends Activity { @Override protected void onCreate(Bundle

    bundle) {
 super.onCreate(bundle);
 Resources res = getResources(); // ...
 }X @Override public String toString() {
 return "MyActivity";
 }X }X MyActivity Activity ContextThemeWrapper Context Object Method Address Object.toString 101 Object.hashCode 102 Context.getResources 201 ...
  154. Method Address Object.toString 101 Object.hashCode 102 ContextTW.getResources 301 ... public

    class MyActivity extends Activity { @Override protected void onCreate(Bundle bundle) {
 super.onCreate(bundle);
 Resources res = getResources(); // ...
 }X @Override public String toString() {
 return "MyActivity";
 }X }X MyActivity Activity ContextThemeWrapper Context Object
  155. public class MyActivity extends Activity { @Override protected void onCreate(Bundle

    bundle) {
 super.onCreate(bundle);
 Resources res = getResources(); // ...
 }X @Override public String toString() {
 return "MyActivity";
 }X }X Method Address Object.toString 101 Object.hashCode 102 ContextTW.getResources 301 ... MyActivity Activity ContextThemeWrapper Context Object
  156. public class MyActivity extends Activity { @Override protected void onCreate(Bundle

    bundle) {
 super.onCreate(bundle);
 Resources res = getResources(); // ...
 }X @Override public String toString() {
 return "MyActivity";
 }X }X MyActivity Activity ContextThemeWrapper Context Object Method Address Object.toString 101 Object.hashCode 102 ContextTW.getResources 301 ...
  157. public class MyActivity extends Activity { @Override protected void onCreate(Bundle

    bundle) {
 super.onCreate(bundle);
 Resources res = getResources(); // ...
 }X @Override public String toString() {
 return "MyActivity";
 }X }X MyActivity Activity ContextThemeWrapper Context Object Method Address MyActivity.toString 501 Object.hashCode 102 ContextTW.getResources 301 ...
  158. public class MyActivity extends Activity { @Override protected void onCreate(Bundle

    bundle) {
 super.onCreate(bundle);
 Resources res = getResources(); // ...
 }X @Override public String toString() {
 return "MyActivity";
 }X }X Method Address MyActivity.toString 501 Object.hashCode 102 ContextTW.getResources 301 ...
  159. public class MyActivity extends Activity { @Override protected void onCreate(Bundle

    bundle) {
 super.onCreate(bundle);
 Resources res = getResources(); // ...
 }X @Override public String toString() {
 return "MyActivity";
 }X }X Method Address MyActivity.toString 501 Object.hashCode 102 ContextTW.getResources 301 ... getResources();
  160. public class MyActivity extends Activity { @Override protected void onCreate(Bundle

    bundle) {
 super.onCreate(bundle);
 Resources res = getResources(); // ...
 }X @Override public String toString() {
 return "MyActivity";
 }X }X Method Address MyActivity.toString 501 Object.hashCode 102 ContextTW.getResources 301 ... getResources(); Method table lookup
  161. public class MyActivity extends Activity { @Override protected void onCreate(Bundle

    bundle) {
 super.onCreate(bundle);
 Resources res = getResources(); // ...
 }X @Override public String toString() {
 return "MyActivity";
 }X }X Method Address MyActivity.toString 501 Object.hashCode 102 ContextTW.getResources 301 ... getResources(); Method table lookup Jump
  162. public class MyActivity extends Activity { @Override protected void onCreate(Bundle

    bundle) {
 super.onCreate(bundle);
 Resources res = getResources(); // ...
 }X @Override public String toString() {
 return "MyActivity";
 }X }X Method Address MyActivity.toString 501 Object.hashCode 102 ContextTW.getResources 301 ... getResources(); getResources(); getResources(); getResources(); getResources(); Method table lookup Jump Method table lookup Jump Method table lookup Jump Method table lookup Jump Method table lookup Jump
  163. public boolean firstShorterThan(List<String> strings, int max) {
 for (int i

    = 0; i < strings.size(); i++) {
 if (strings.get(i).length() > max) {
 return i;
 }X
 }X
 return -1;
 }X 
 strings.size()
  164. public boolean firstShorterThan(List<String> strings, int max) {
 for (int i

    = 0; i < strings.size(); i++) {
 if (strings.get(i).length() > max) {
 return i;
 }X
 }X
 return -1;
 }X strings.size()
  165. public boolean firstShorterThan(List<String> strings, int max) {
 for (int i

    = 0; i < strings.size(); i++) {
 if (strings.get(i).length() > max) {
 return i;
 }X
 }X
 return -1;
 }X strings.size() Class lookup
  166. public boolean firstShorterThan(List<String> strings, int max) {
 for (int i

    = 0; i < strings.size(); i++) {
 if (strings.get(i).length() > max) {
 return i;
 }X
 }X
 return -1;
 }X strings.size() Method table lookup Jump Class lookup
  167. Resources res = mResources; private Resources mResources; mResources Memory lookup

    Copy to local mResources mResources mResources mResources
  168. Resources res = mResources; private Resources mResources; mResources Memory lookup

    Copy to local mResources mResources mResources mResources Memory lookup Copy to local Memory lookup Copy to local Memory lookup Copy to local Memory lookup Copy to local
  169. for (int i = 0; i < strings.size(); i++) @Override

    public int size() {
 return ;
 } int size; 
 size
  170. for (int i = 0; ix< strings.size;yi++) int size; size

    Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy to local size Memory lookup Copy size Memory lookup ookup Copy to local size Memory
  171. for (int i = 0, size = strings.size; ix< size;yi++)

    int size; Memory lookup Copy to local size
  172. StringBuilder b = new StringBuilder(key).append("."); int truncateTo = b.length(); for

    (int x = 0; x < valueCount; x++) {
 b.append(x);
 cleanFiles[x] = new File(directory, b.toString()); b.append(".tmp");
 dirtyFiles[x] = new File(directory, b.toString()); b.setLength(truncateTo);
 }X public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>(users.size());
 for (User user : users) {
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  173. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>(users.size());


    for (User user : users) {
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  174. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>(users.size());


    for (Iterator<User> iter = users.iterator(); iter.hasNext(); ) {
 User user = iter.next();
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  175. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>(users.size());


    for (Iterator<User> iter = users.iterator(); iter.hasNext(); ) {
 User user = iter.next();
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  176. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>(users.size());


    for (Iterator<User> iter = users.iterator(); iter.hasNext(); ) {
 User user = iter.next();
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  177. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>(users.size());


    for (Iterator<User> iter = users.iterator(); iter.hasNext(); ) {
 User user = iter.next();
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  178. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>(users.size());


    for (Iterator<User> iter = users.iterator(); iter.hasNext(); ) {
 User user = iter.next();
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  179. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>(users.size());


    for (Iterator<User> iter = users.iterator(); iter.hasNext(); ) {
 User user = iter.next();
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  180. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>(users.size());


    for (int x = 0, size = users.size(); x < size; x++) {
 User user = users.get(x);
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  181. public List<String> names(List<User> users) {
 List<String> names = new ArrayList<>(users.size());


    for (int x = 0, size = users.size(); x < size; x++) {
 User user = users.get(x);
 names.add(user.name);
 }X
 return unmodifiableList(names);
 }X
  182. StringBuilder b = new StringBuilder(key).append("."); int truncateTo = b.length(); for

    (int x = 0; x < valueCount; x++) {
 b.append(x);
 cleanFiles[x] = new File(directory, b.toString()); b.append(".tmp");
 dirtyFiles[x] = new File(directory, b.toString()); b.setLength(truncateTo);
 }X
  183. int valueCount = this.valueCount; File directory = this.directory; File[] cleanFiles

    = this.cleanFiles; File[] dirtyFiles = this.dirtyFiles; StringBuilder b = new StringBuilder(key).append("."); int truncateTo = b.length(); for (int x = 0; x < valueCount; x++) {
 b.append(x);
 cleanFiles[x] = new File(directory, b.toString()); b.append(".tmp");
 dirtyFiles[x] = new File(directory, b.toString()); b.setLength(truncateTo);
 }X
  184. StringBuilder b = new StringBuilder(key).append("."); int truncateTo = b.length(); for

    (int x = 0; x < valueCount; x++) {
 b.append(x);
 cleanFiles[x] = new File(directory, b.toString()); b.append(".tmp");
 dirtyFiles[x] = new File(directory, b.toString()); b.setLength(truncateTo);
 }X
  185. What else? • Polymorphic virtual method calls • Monomorphic vs.

    bimorphic vs. megamorphic • Concurrency implications & locks • Read/write when lock, act out of lock • synchronized vs. concurrent lock types