From 8666eeee7e891feb1bcc9936b31e5d7fd938b0b4 Mon Sep 17 00:00:00 2001 From: Anton Makeev Date: Sat, 21 May 2011 15:46:07 +0200 Subject: [PATCH] AppCode: custom Source Trees --- .../src/com/intellij/openapi/util/Pair.java | 35 ++++++++++++------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/platform/util/src/com/intellij/openapi/util/Pair.java b/platform/util/src/com/intellij/openapi/util/Pair.java index 103e02707379..ba38a591cfcb 100644 --- a/platform/util/src/com/intellij/openapi/util/Pair.java +++ b/platform/util/src/com/intellij/openapi/util/Pair.java @@ -23,6 +23,28 @@ public class Pair { public final A first; public final B second; + + public static Pair create(A first, B second) { + return new Pair(first, second); + } + + @SuppressWarnings({"UnusedDeclaration"}) + public static Function> createFunction(@Nullable final B value) { + return new Function>() { + public Pair fun(A a) { + return create(a, value); + } + }; + } + + public static T getFirst(@Nullable Pair pair) { + return pair != null ? pair.first : null; + } + + public static T getSecond(@Nullable Pair pair) { + return pair != null ? pair.second : null; + } + public Pair(A first, B second) { this.first = first; this.second = second; @@ -36,19 +58,6 @@ public class Pair { return second; } - public static Pair create(A first, B second) { - return new Pair(first, second); - } - - @SuppressWarnings({"UnusedDeclaration"}) - public static Function> createFunction(@Nullable final B value) { - return new Function>() { - public Pair fun(A a) { - return create(a, value); - } - }; - } - public final boolean equals(Object o) { return o instanceof Pair && Comparing.equal(first, ((Pair)o).first) && Comparing.equal(second, ((Pair)o).second); }