code: public static double dot(NumberVector v1, NumberVector v2) {
      // Java Hotspot appears to optimize these better than if-then-else:
      return v1 instanceof SparseNumberVector ? //
          v2 instanceof SparseNumberVector ? //
              dotSparse((SparseNumberVector) v1, (SparseNumberVector) v2) : //
              dotSparseDense((SparseNumberVector) v1, v2) : //
          v2 instanceof SparseNumberVector ? //
              dotSparseDense((SparseNumberVector) v2, v1) : //
              dotDense(v1, v2);
    }
docs: Compute the dot product of the angle between two vectors.
  
  @param v1 first vector
  @param v2 second vector
  @return Dot product