hbase-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nspiegelb...@apache.org
Subject svn commit: r1054843 - /hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/Pair.java
Date Tue, 04 Jan 2011 00:33:48 GMT
Author: nspiegelberg
Date: Tue Jan  4 00:33:48 2011
New Revision: 1054843

URL: http://svn.apache.org/viewvc?rev=1054843&view=rev
Log:
Add factory pattern to Pair so template types can be inferred from input
params.

Modified:
    hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/Pair.java

Modified: hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/Pair.java
URL: http://svn.apache.org/viewvc/hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/Pair.java?rev=1054843&r1=1054842&r2=1054843&view=diff
==============================================================================
--- hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/Pair.java (original)
+++ hbase/trunk/src/main/java/org/apache/hadoop/hbase/util/Pair.java Tue Jan  4 00:33:48 2011
@@ -51,7 +51,19 @@ public class Pair<T1, T2> implements Ser
     this.first = a;
     this.second = b;
   }
-
+  
+  /**
+   * Constructs a new pair, inferring the type via the passed arguments
+   * @param <T1> type for first
+   * @param <T2> type for second
+   * @param a first element
+   * @param b second element
+   * @return a new pair containing the passed arguments
+   */
+  public static <T1,T2> Pair<T1,T2> newPair(T1 a, T2 b) {
+    return new Pair<T1,T2>(a, b);
+  }
+  
   /**
    * Replace the first element of the pair.
    * @param a operand



Mime
View raw message