Java Stream API — Even Numbers (Full Screen) Java Stream API — Get Even Numbers Example 1 — Filter even numbers from a list Creates a list, uses Stream to filter evens, and prints them. Copy import java.util.*; import java.util.stream.*; public class EvenNumbersStream { public static void main(String[] args) { // Create a list of numbers List<Integer> numbers = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); // Use Stream API to filter even numbers List<Integer> evenNumbers = numbers.stream() .filter(n -> n % 2 == 0) .collect(Collectors.toList()); // Print the even numbers System.out.println( "Even numbers: " + evenNumbers); } } Example 2 — Use IntStream.rangeClosed ...
In this Post , we will discuss about the new spam message , which has recently started circulating via whatsapp and it is making everyone’s whatsapp application crashed... A new spam message has recently started circulating via whatsapp that is making everyone’s whatsapp application crashed when they’re clicking on the message that is something like – “if you touch the black point then your whatsapp will hang..don’t touch here”.(See pic1) pic1 For understanding the reason, you’ll need to have a basic knowledge about ASCII values. Typically ASCII decimal number is created from binary, which is the language that all computers understand. Each alphabet has its own ASCII value (i.e: "A" has a ASCII value of 065). So if you send a text message on whatsapp, the system first breaks down each and every alphabet into ASCII characters. But there’s a limit in the numbers of text (ASCII values) that you can send via a single message in whatsapp messenger. Whatsapp encount...