The code map and mapToSelf methods operate on vectors element-wise, i.e. they perform the same operation (adding a scalar, applying a function …) on each element in turn. The map versions create a new vector to hold the result and do not change the instance. The mapToSelf version uses the instance itself to store the results, so the instance is changed by this method. In all cases, the result vector is returned by the methods, allowing the fluent API style, like this: This method computes the distance consistent with the L2 norm, i.e. the square root of the sum of element differences, or Euclidean distance. This method computes the distance consistent with L1 norm, i.e. the sum of the absolute values of the elements differences. This method computes the distance consistent with L∞ norm, i.e. the max of the absolute values of element differences. Note: derived classes are required to return an Iterator that returns non-null RealVector.Entry objects as long as Iterator.hasNext() returns true. Note: derived classes are required to return an Iterator that returns non-null RealVector.Entry objects as long as Iterator.hasNext() returns true. Test for the equality of two real vectors. If all coordinates of two real vectors are exactly the same, and none are NaN, the two real vectors are considered to be equal. NaN coordinates are considered to affect globally the vector and be equals to each other – i.e, if either (or all) coordinates of the real vector are equal to NaN, the real vector is equal to a vector with all NaN coordinates. This method must be overriden by concrete subclasses of RealVector (the current implementation throws an exception). Source.