0% found this document useful (0 votes)
5 views1 page

IntStream and LongStream Example

The code defines an integer and long array containing numbers 1 through 10. It uses Java 8 streams to check if the integer array contains the number 4 and prints a message accordingly. It also checks if the long array contains 10 and prints a matching message.

Uploaded by

ripudsudan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views1 page

IntStream and LongStream Example

The code defines an integer and long array containing numbers 1 through 10. It uses Java 8 streams to check if the integer array contains the number 4 and prints a message accordingly. It also checks if the long array contains 10 and prints a matching message.

Uploaded by

ripudsudan
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

package [Link].

core;

import [Link];
import [Link];

public class TestDate {

public static void main(String[] args) {

int[] number = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};

//Java 8
boolean result = [Link](number).anyMatch(x -> x == 4);

if (result) {
[Link]("Hello 4");
} else {
[Link]("Where is number 4?");
}

long[] lNumber = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};

boolean result2 = [Link](lNumber).anyMatch(x -> x == 10);

if (result2) {
[Link]("Hello 10");
} else {
[Link]("Where is number 10?");
}

You might also like