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

autofixture.implementationdetails.Boxing Maven / Gradle / Ivy

There is a newer version: 2.1.10
Show newest version
package autofixture.implementationdetails;

import java.util.ArrayList;
import java.util.stream.DoubleStream;
import java.util.stream.IntStream;
import java.util.stream.LongStream;

public class Boxing {
  public static Long[] boxed(final long[] other) {
    return LongStream.of(other).boxed().toArray(Long[]::new);
  }

  public static Float[] boxed(final float[] other) {
    final ArrayList list = new ArrayList<>();
    for (final float f : other) {
      list.add(f);
    }
    return list.toArray(new Float[]{});
  }

  public static Short[] boxed(final short[] other) {
    final ArrayList list = new ArrayList<>();
    for (final short s : other) {
      list.add(s);
    }
    return list.toArray(new Short[]{});
  }

  public static Double[] boxed(final double[] other) {
    return DoubleStream.of(other).boxed().toArray(Double[]::new);
  }

  public static Integer[] boxed(final int... other) {
    return IntStream.of(other).boxed().toArray(Integer[]::new);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy