Tips & Tricks

Debugger: working with sub-ranges for arrays and lists

During debugging IntelliJ IDEA shows only the first 100 elements of arrays and collections. It’s enough in most cases. However, it’s sometimes convenient to use a custom range. Exactly for this the ‘Adjust Range’ action has been available for arrays for quite a long time. But recently we’ve made a couple of improvements to it. Namely:

  • ‘Adjust Range’ works with lists now
  • adjusted range is preserved for local variables delivered to another stack frame

Quick demonstration example:

  1. Start debugger and wait until target break point is hit;
  2. Right click on target array/list and select the ‘Adjust Range…’ action:
  3. Define a range:
  4. Check the result:
image description

Discover more