From 8f381ae243fe608943e952c00a416878d6c10a92 Mon Sep 17 00:00:00 2001 From: Nadya Zabrodina Date: Mon, 24 Apr 2017 13:01:49 +0300 Subject: [PATCH] [vcs]: cleanUP - streamApi --- .../CommittedChangesVisibilityPredicate.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesVisibilityPredicate.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesVisibilityPredicate.java index 94d4fca858a1..a90312140936 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesVisibilityPredicate.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/committed/CommittedChangesVisibilityPredicate.java @@ -20,6 +20,7 @@ import com.intellij.openapi.vcs.AbstractVcs; import com.intellij.openapi.vcs.ProjectLevelVcsManager; import com.intellij.openapi.vcs.VcsType; import com.intellij.util.NotNullFunction; +import one.util.streamex.StreamEx; import org.jetbrains.annotations.NotNull; /** @@ -28,12 +29,10 @@ import org.jetbrains.annotations.NotNull; public class CommittedChangesVisibilityPredicate implements NotNullFunction { @NotNull public Boolean fun(final Project project) { - final AbstractVcs[] abstractVcses = ProjectLevelVcsManager.getInstance(project).getAllActiveVcss(); - for(AbstractVcs vcs: abstractVcses) { - if (vcs.getCommittedChangesProvider() != null && VcsType.centralized.equals(vcs.getType())) { - return Boolean.TRUE; - } - } - return Boolean.FALSE; + return StreamEx.of(ProjectLevelVcsManager.getInstance(project).getAllActiveVcss()).anyMatch(vcs -> isCommittedChangesAvailable(vcs)); + } + + public static boolean isCommittedChangesAvailable(@NotNull AbstractVcs vcs) { + return vcs.getCommittedChangesProvider() != null && VcsType.centralized.equals(vcs.getType()); } }