mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
introduce processEach(), consumeEach()
This commit is contained in:
@@ -20,9 +20,7 @@ import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.Conditions;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.Functions;
|
||||
import com.intellij.util.PairFunction;
|
||||
import com.intellij.util.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -195,6 +193,16 @@ public abstract class JBIterable<E> implements Iterable<E> {
|
||||
return (T) iterator();
|
||||
}
|
||||
|
||||
public boolean processEach(@NotNull Processor<E> processor) {
|
||||
return ContainerUtil.process(this, processor);
|
||||
}
|
||||
|
||||
public void consumeEach(@NotNull Consumer<E> consumer) {
|
||||
for (E e : this) {
|
||||
consumer.consume(e);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of this iterable up to 50 elements, with the format
|
||||
* {@code (e1, e2, ..., en [, ...] )} for debugging purposes.
|
||||
@@ -667,9 +675,7 @@ public abstract class JBIterable<E> implements Iterable<E> {
|
||||
|
||||
@NotNull
|
||||
static <T> T copy(@NotNull T o) {
|
||||
if (!(o instanceof Stateful)) {
|
||||
return o;
|
||||
}
|
||||
if (!(o instanceof Stateful)) return o;
|
||||
return (T)((Stateful)o).clone();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user