### Question:
Vectors { @Nonnull public static Long2DoubleMap multiplyScalar(Long2DoubleMap vector, double value) { SortedKeyIndex idx = SortedKeyIndex.fromCollection(vector.keySet()); int n = idx.size(); double[] values = new double[n]; for (int i = 0; i < n; i++) { values[i] = vector.get(idx.getKey(i)) * value; } return Long2DoubleSortedArrayMap.wrap(idx, values); } private  Vectors(); static Iterator<Long2DoubleMap.Entry> fastEntryIterator(Long2DoubleMap map); static Iterable<Long2DoubleMap.Entry> fastEntries(final Long2DoubleMap map); static double sum(Long2DoubleMap v); static double sumAbs(Long2DoubleMap v); static double sumOfSquares(Long2DoubleMap v); static double sumOfSquares(Long2DoubleSortedArrayMap v); static double euclideanNorm(Long2DoubleMap v); static Long2DoubleMap unitVector(Long2DoubleMap v); static double dotProduct(Long2DoubleMap v1, Long2DoubleMap v2); static double dotProduct(Long2DoubleSortedArrayMap v1, Long2DoubleSortedArrayMap v2); static double mean(Long2DoubleMap vec); static Long2DoubleMap combine(Long2DoubleMap x, Long2DoubleFunction y, double sy, double o); static Long2DoubleMap addScalar(Long2DoubleMap vec, double val); @Nonnull static Long2DoubleMap multiplyScalar(Long2DoubleMap vector, double value); static Long2DoubleMap transform(Long2DoubleMap input, DoubleUnaryOperator function); static RealVector matrixRow(RealMatrix mat, int row);  }### Answer:
@Test public void testMultiplyScalar() { assertThat(Vectors.multiplyScalar(EMPTY_MAP, 2).size(), equalTo(0)); Long2DoubleMap result; result = Vectors.multiplyScalar(singleton(42, 3), 2); assertThat(result.keySet(), contains(42L)); assertThat(result, hasEntry(42L, 6.0)); Long2DoubleMap input = new Long2DoubleOpenHashMap(); input.put(42L, 5); input.put(22L, -2); result = Vectors.multiplyScalar(input, -1); assertThat(result.keySet(), containsInAnyOrder(42L, 22L)); assertThat(result, hasEntry(42L, -5.0)); assertThat(result, hasEntry(22L, 2.0)); }