예제 #1
0
 protected int getBucketIdx(TextPair key) {
   String first = key.getFirst().toString(), second = key.getSecond().toString();
   if (first.length() > 0 && second.length() > 0) return 0;
   return (first.length() > 0) ? 1 : 2;
 }
예제 #2
0
 protected int getAssignedPartition(TextPair key, int bucketIdx) {
   int size = bucketSize[bucketIdx];
   return bucketOffst[bucketIdx]
       + ((key.getFirst().hashCode() % size) + (key.getSecond().hashCode() % size)) % size;
 }