mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
AppCode: custom Source Trees
This commit is contained in:
@@ -23,6 +23,28 @@ public class Pair<A, B> {
|
||||
public final A first;
|
||||
public final B second;
|
||||
|
||||
|
||||
public static <A, B> Pair<A, B> create(A first, B second) {
|
||||
return new Pair<A, B>(first, second);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"UnusedDeclaration"})
|
||||
public static <A, B> Function<A, Pair<A, B>> createFunction(@Nullable final B value) {
|
||||
return new Function<A, Pair<A, B>>() {
|
||||
public Pair<A, B> fun(A a) {
|
||||
return create(a, value);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public static <T> T getFirst(@Nullable Pair<T, ?> pair) {
|
||||
return pair != null ? pair.first : null;
|
||||
}
|
||||
|
||||
public static <T> T getSecond(@Nullable Pair<?, T> 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<A, B> {
|
||||
return second;
|
||||
}
|
||||
|
||||
public static <A, B> Pair<A, B> create(A first, B second) {
|
||||
return new Pair<A,B>(first, second);
|
||||
}
|
||||
|
||||
@SuppressWarnings({"UnusedDeclaration"})
|
||||
public static <A, B> Function<A, Pair<A, B>> createFunction(@Nullable final B value) {
|
||||
return new Function<A, Pair<A, B>>() {
|
||||
public Pair<A, B> 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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user