私はいくつかの方法をうまく試してみました。Java 8を使用してint配列をlong配列に変換しますか?
this.tileUpdateTimes
はlong[]
あるとother.tileUpdateTimes
が、私はこの問題を解決するにはどうすればよいint[]
this.tileUpdateTimes = Arrays.stream(other.tileUpdateTimes).toArray(size -> new long[size]);
this.tileUpdateTimes = Arrays.stream(other.tileUpdateTimes)
.map(item -> ((long) item)).toArray();
のですか?
あなたが短いから同じことをするでしょうか[]を? –
@EladBendaストリームAPIには 'ShortStream'がありませんので、そのタスクには使用しません。あなたは伝統的なforループを使用することができます。 – Tunaki
'.mapToLong(i - > i)'のステップは、 'int'から' long'への変換が本質的に扱えるので時代遅れです: 'Arrays.stream(intArray).asLongStream()。toArray()' ... – Holger