Sounds like you need findFirst here
Optional<Map.Entry<Item, Boolean>> firstEntry = processedItem.entrySet().stream().findFirst();
Obviously, the HashMap is out of order, so findFirst may return a different result for different calls. Probably a more suitable method would be findAny for your case.
source share