Languages
[Edit]
PL

Java - przekonwertuj double[] na List<Double> - pierwotna podwójna tablica na listę obiektów

6 points
Created by:
Sylwia
3590

Opis problemu

1. Najlepsze rozwiązanie - DoubleStream.of (Java 8)

Edit

Wynik:

2. DoubleStream.of + zwrot ArrayList (Java 8)

Edit

Zwrot wymaganej implementacji np ArrayList lub HashSet

Wynik:

3. Jawna iteracja po tablicy (before Java 8)

Edit

Wynik:

4. Doubles.asList (Guava)

Edit

Wynik:

5. ArrayUtils.toObject (Apache commons lang3)

Edit

Wynik:

Podsumowanie - w Javie możemy zamienić double[] na List<Double> przez:

Edit
  1. Najlepsze rozwiązanie - DoubleStream.of (Java 8)
  2. DoubleStream.of + zwrot ArrayList (Java 8)
  3. Jawna iteracja po tablicy (before Java 8)
  4. Doubles.asList (Guava)
  5. ArrayUtils.toObject (Apache commons lang3)

Bibliografia

Edit
  1. DoubleStream.of - Java 8 docs
  2. Doubles.asList - Guava docs
  3. ArrayUtils.toObject - Apache commons lang3 docs
1
Donate to Dirask
Our content is created by volunteers - like Wikipedia. If you think, the things we do are good, donate us. Thanks!
Join to our subscribers to be up to date with content, news and offers.
Native Advertising
🚀
Get your tech brand or product in front of software developers.
For more information Contact us
Dirask - we help you to
solve coding problems.
Ask question.

❤️💻 🙂

Join