diff --git a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/util/functions.kt b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/util/functions.kt index 6c0380d192bf..a285b2587b46 100644 --- a/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/util/functions.kt +++ b/plugins/groovy/groovy-psi/src/org/jetbrains/plugins/groovy/util/functions.kt @@ -1,8 +1,17 @@ -// Copyright 2000-2017 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. +// Copyright 2000-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file. package org.jetbrains.plugins.groovy.util -import com.intellij.util.Consumer +import java.util.function.Consumer +import com.intellij.util.Consumer as JBConsumer -fun Consumer.consumeAll(items: Iterable) { +fun JBConsumer.consumeAll(items: Iterable) { items.forEach(this::consume) } + +operator fun Consumer.plusAssign(elements: Iterable) { + elements.forEach(this::plusAssign) +} + +operator fun Consumer.plusAssign(element: T) { + accept(element) +}