简体   繁体   English

如何将普通的双精度数组转换为番石榴不可变数组

[英]How can I convert a normal array of doubles to a guava immutable array

I was just wondering how would i go about converting this:我只是想知道如何将 go 转换为:

Into a Google Guava ImmutableDoubleArray.进入 Google Guava ImmutableDoubleArray。

public class Data  {

    private final ImmutableDoubleArray arrays;

    public Data(double[] array)
    {

    }

Thank you.谢谢你。

this.arrays = ImmutableDoubleArray.copyOf(array);

Using ImmutableDoubleArray is generally preferable to using ImmutableList , because it does not come with the overhead of boxing.使用ImmutableDoubleArray通常比使用ImmutableList更可取,因为它没有装箱的开销。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM