How to check if player has item with display name in inventory

Hello! I am currently making a plugin that requires me to check if a player has an item with a specified display name in their inventory. I tried iterating through all the items in the player inventory like this