GroovyExtensions.groovy 565 B

12345678910111213141516171819
  1. class GroovyExtensions {
  2. static void apply() {
  3. List.metaClass {
  4. findQuotedElement = { Map<String, String> conditions ->
  5. delegate.find { element ->
  6. conditions.every { condition, value -> element[condition] == value }
  7. }
  8. }
  9. findQuotedElements = { Map<String, String> conditions ->
  10. delegate.findAll { element ->
  11. conditions.every { condition, value -> element[condition] == value }
  12. }
  13. }
  14. }
  15. }
  16. }