Configuration (@NotNull Collection<? extends Configuration> configurations, Configuration configuration) { return ContainerUtil.find(configurations, c -> { if (configuration instanceof ReplaceConfiguration) { return c instanceof ReplaceConfiguration && c.getMatchOptions().getSearchPattern().equals(configuration.getMatchOptions().getSearchPattern()) && c.getReplaceOptions().getReplacement().equals(configuration.getReplaceOptions().getReplacement()); } else { return c instanceof SearchConfiguration && c.getMatchOptions().getSearchPattern().equals( configuration.getMatchOptions().getSearchPattern()); } }); }