import java.util.*; import java.util.stream.*; public class Main{ public static void main(String[] args) { ArrayList<Integer> al=new ArrayList<>(); al.add(7); al.add(90); al.add(4); al.add(18); al.add(3); System.out.println("List : "+al); Stream<Double> stm=al.stream().map(n->Math.sqrt(n)); stm.forEach(n->System.out.println(n+" ")); } }
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter