Debugging in IntelliJ with Conditional Breakpoints

IntelliJ allows us to create conditional breakpoints which can be helpful when debugging an application.

Suppose we have a loop iterating over a collection of 1000 product codes, and we are only interested in pausing execution when a product code “765” is being evaluated:

package com.sandbox;

import java.util.LinkedHashSet;
import java.util.Set;

public class Main {

    public static void main(String[] args) {
        Set<String> productCodeList = populateCodes(1000);

        for(String productCode : productCodeList) {

    private static Set<String> populateCodes(final int count) {
        Set<String> productCodeList = new LinkedHashSet<>>();

        for(int i = 0; i < count; i++) {

        return productCodeList;

    private static void doSomething(final String productCode) {}

We can insert a breakpoint on line 12 and then right-click on the red dot to add our condition: