Exemplo n.º 1
0
 @Override
 public int hashCode() {
   int result = 1;
   for (int i = start; i < end; i++) {
     result = 31 * result + Shorts.hashCode(array[i]);
   }
   return result;
 }
Exemplo n.º 2
0
 @Override
 public int lastIndexOf(Object target) {
   // Overridden to prevent a ton of boxing
   if (target instanceof Short) {
     int i = Shorts.lastIndexOf(array, (Short) target, start, end);
     if (i >= 0) {
       return i - start;
     }
   }
   return -1;
 }
Exemplo n.º 3
0
 @Override
 public int compare(short[] left, short[] right) {
   int minLength = Math.min(left.length, right.length);
   for (int i = 0; i < minLength; i++) {
     int result = Shorts.compare(left[i], right[i]);
     if (result != 0) {
       return result;
     }
   }
   return left.length - right.length;
 }
Exemplo n.º 4
0
 @Override
 public boolean contains(Object target) {
   // Overridden to prevent a ton of boxing
   return (target instanceof Short) && Shorts.indexOf(array, (Short) target, start, end) != -1;
 }