All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.simiacryptus.util.ArrayUtil Maven / Gradle / Ivy

There is a newer version: 2.1.0
Show newest version
package com.simiacryptus.util;

import java.util.Arrays;
import java.util.function.IntToDoubleFunction;
import java.util.function.LongToDoubleFunction;

public class ArrayUtil
{

  public static double[] toDouble(final int[] from, final IntToDoubleFunction f)
  {
    final double[] to = new double[from.length];
    Arrays.setAll(to, i -> f.applyAsDouble(from[i]));
    return to;
  }

  public static double[] toDouble(final long[] from, final LongToDoubleFunction f)
  {
    final double[] to = new double[from.length];
    Arrays.setAll(to, i -> f.applyAsDouble(from[i]));
    return to;
  }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy