mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[groovy] add Consumer.plusAssign
This commit is contained in:
@@ -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 <T> Consumer<T>.consumeAll(items: Iterable<T>) {
|
||||
fun <T> JBConsumer<T>.consumeAll(items: Iterable<T>) {
|
||||
items.forEach(this::consume)
|
||||
}
|
||||
|
||||
operator fun <T> Consumer<in T>.plusAssign(elements: Iterable<T>) {
|
||||
elements.forEach(this::plusAssign)
|
||||
}
|
||||
|
||||
operator fun <T> Consumer<in T>.plusAssign(element: T) {
|
||||
accept(element)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user