Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. All programs tested and work.

aviboots(AT)netvision.net.il

Instant Grammar Checker - Correct all grammar errors and enhance your writing
BlueHost Web Hosting

Profollica™ is a standout product in the hair regrowth industry.

New Arrival!  Shop NOW for metal eyeglasses at GlassesShop.com!

Bonsai Boy of New York Bonsai Trees and Accessories

DreamCloud The Comfortable Luxury Mattress Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

DreamHost Web Hosting


Liquid Web Cloud VPS Hosting

Disclosure We are a professional Programming & Software Q&A website, that receives compensation from some of the links whose we show you with Information. It means that my content may contain affiliate links.

13,627 questions

18,538 answers

573 users

How to print ArrayList in Java

6 Answers

0 votes
import java.util.*;
 
public class MyClass {
    public static void main(String args[]) {
        ArrayList<Double> arrlist = new ArrayList<Double>();
        
        arrlist.add(79.12);
        arrlist.add(28.01);
        arrlist.add(47.98);
        arrlist.add(83.87);
        arrlist.add(99.31);

        for (int i = 0; i < arrlist.size(); i++) {
            System.out.println(arrlist.get(i));
        }
    }
}
 
 
 
 
/*
run:
 
79.12
28.01
47.98
83.87
99.31
 
*/

 




answered Oct 3, 2019 by avibootz
0 votes
import java.util.*;
 
public class MyClass {
    public static void main(String args[]) {
        ArrayList<Double> arrlist = new ArrayList<Double>();
        
        arrlist.add(79.12);
        arrlist.add(28.01);
        arrlist.add(47.98);
        arrlist.add(83.87);
        arrlist.add(99.31);
        
        System.out.println(Arrays.toString(arrlist.toArray()));
    }
}
 
 
 
 
/*
run:
 
[79.12, 28.01, 47.98, 83.87, 99.31]
 
*/

 




answered Oct 3, 2019 by avibootz
0 votes
import java.util.*;
 
public class MyClass {
    public static void main(String args[]) {
        ArrayList<Double> arrlist = new ArrayList<Double>();
        
        arrlist.add(79.12);
        arrlist.add(28.01);
        arrlist.add(47.98);
        arrlist.add(83.87);
        arrlist.add(99.31);
        
        for (Double n : arrlist) {
            System.out.println(n);
        }
    }
}
 
 
 
 
/*
run:
 
79.12
28.01
47.98
83.87
99.31
 
*/

 




answered Oct 3, 2019 by avibootz
0 votes
import java.util.*;
 
public class MyClass {
    public static void main(String args[]) {
        ArrayList<Double> arrlist = new ArrayList<Double>();
        
        arrlist.add(79.12);
        arrlist.add(28.01);
        arrlist.add(47.98);
        arrlist.add(83.87);
        arrlist.add(99.31);
        
        // Lambda Expression
        arrlist.forEach((Double value) -> System.out.println(value));
    }
}
 
 
 
 
/*
run:
 
79.12
28.01
47.98
83.87
99.31
 
*/

 




answered Oct 3, 2019 by avibootz
0 votes
import java.util.*;
 
public class MyClass {
    public static void main(String args[]) {
        ArrayList<Double> arrlist = new ArrayList<Double>();
        
        arrlist.add(79.12);
        arrlist.add(28.01);
        arrlist.add(47.98);
        arrlist.add(83.87);
        arrlist.add(99.31);
        
        // Lambda Expression
        arrlist.forEach(value -> System.out.println(value));
    }
}
 
 
 
 
/*
run:
 
79.12
28.01
47.98
83.87
99.31
 
*/

 




answered Oct 3, 2019 by avibootz
0 votes
import java.util.*;
 
public class MyClass {
    public static void main(String args[]) {
        ArrayList<Double> arrlist = new ArrayList<Double>();
        
        arrlist.add(79.12);
        arrlist.add(28.01);
        arrlist.add(47.98);
        arrlist.add(83.87);
        arrlist.add(99.31);
        
        // Lambda Expression
        arrlist.forEach(System.out::println);
    }
}
 
 
 
 
/*
run:
 
79.12
28.01
47.98
83.87
99.31
 
*/

 




answered Oct 3, 2019 by avibootz
...