masiboo
masiboo

Reputation: 4719

How to debug huge data collections in Intellij

In the application, I have huge data set in various collection container such as List, Map, Set, etc. For example:-

static List<Employee> employeeList = Arrays.asList(
        new Employee("Tom Jones", 45),
        new Employee("Harry Major", 25),
        new Employee("Ethan Hardy", 65),
        new Employee("Nancy Smith", 22),
        new Employee("Deborah Sprightly", 29),
        new Employee("Billy Kid", 22),
        new Employee("George King", 44),
        new Employee("Annie Barrey", 19));

Here are only a few items in the list hardcoded. But if I have more than 10 thousands of item in the list. How can I verify an Employee named "George King" is exist in this list? I know how to do it by code. But will it be possible to quickly verify this in the Intellij debugger? My assumption there should be some way. Please let me know how can do it without stepping and iterate all the values one by one.

Upvotes: 1

Views: 289

Answers (2)

Arun Sivanandan
Arun Sivanandan

Reputation: 79

you can try setting a breakpoint in this line

static List<Employee> employeeList = Arrays.asList(

and check the content in the list in the debugger window like in the image below.

enter image description here

Thanks, I hope this answers your question.

Upvotes: -1

Kayaman
Kayaman

Reputation: 73558

One way would be to set a conditional breakpoint, with the condition being contains(...) sort of thing.

Upvotes: 2

Related Questions