ACCUMULO-2490 Make Pair API more generics-friendly

Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo
Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/053e83fc
Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/053e83fc
Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/053e83fc

Branch: refs/heads/master
Commit: 053e83fc4225969efda31ee4957651640cc7ac9e
Parents: 0992c42
Author: Christopher Tubbs <ctubb...@apache.org>
Authored: Tue Mar 18 01:01:11 2014 -0400
Committer: Christopher Tubbs <ctubb...@apache.org>
Committed: Tue Mar 18 01:01:11 2014 -0400

----------------------------------------------------------------------
 core/src/main/java/org/apache/accumulo/core/util/Pair.java | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/053e83fc/core/src/main/java/org/apache/accumulo/core/util/Pair.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/accumulo/core/util/Pair.java 
b/core/src/main/java/org/apache/accumulo/core/util/Pair.java
index 00eab0e..159a77b 100644
--- a/core/src/main/java/org/apache/accumulo/core/util/Pair.java
+++ b/core/src/main/java/org/apache/accumulo/core/util/Pair.java
@@ -72,16 +72,16 @@ public class Pair<A,B> {
     return prefix + first + separator + second + suffix;
   }
 
-  public Entry<A,B> toMapEntry() {
+  public Entry<? super A,? super B> toMapEntry() {
     return new SimpleImmutableEntry<A,B>(getFirst(), getSecond());
   }
 
-  public Pair<B,A> swap() {
+  public Pair<? super B,? super A> swap() {
     return new Pair<B,A>(getSecond(), getFirst());
   }
 
-  public static <K,V> Pair<K,V> fromEntry(Entry<K,V> entry) {
-    return new Pair<K,V>(entry.getKey(), entry.getValue());
+  public static <K2,V2,K1 extends K2,V1 extends V2> Pair<K2,V2> 
fromEntry(Entry<K1,V1> entry) {
+    return new Pair<K2,V2>(entry.getKey(), entry.getValue());
   }
 
 }

Reply via email to