Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

This noncompliant example is comprised of an ArrayList collection which is non-thread-safe by default. There is, however, a way around this drawback. Most thread-unsafe classes have a synchronized thread-safe version, for example, Collections.synchronizedList being is a good substitute for ArrayList and Collections.synchronizedMap is a good alternative to HashMap. One pitfall described in the coming lines, remains to be addressed even when the particular Collection offers thread-safety benefits.

...