Property (@NotNull final Collection<Property> properties, @NotNull final PyFunction functionToSearch) { for (final Property property : properties) { for (final PyFunction function : getAllFunctions(property)) { if (function.equals(functionToSearch)) { return property; } } } throw new IllegalArgumentException("No property found"); }