Java Streams Interview Question - 05 - Print Numbers Starts With Prefix 2 using Streams

preview_player
Показать описание
Java Streams Interview Question - 05 - Print Even & Odd Numbers using Streams

Schedule a meeting in case of any queries/guidance/counselling:

~~~Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:

Follow me on my Facebook Page:

Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:

Naveen AutomationLabs Paid Courses:
GIT Hub Course:

Java & Selenium:

Java & API +POSTMAN + RestAssured + HttpClient:
Рекомендации по теме
Комментарии
Автор

Hey Naveen thanks for the video This would also do without using map and method reference. But your video give more Java 8 features, that's also excellent.
List<Integer> integersStartingWith = integerList.stream().filter(e ->
e.toString().charAt(0) == '2'

ANSUPLOADS
Автор

e -> e.startsWith("2") || e.startsWith("-2")

gauravshirskar
Автор

Predicate<Integer> startsWith2 = e -> e.startsWith("2");
Predicate<Integer> startsWithNegative2 = e -> e.startsWith("-2");

numbers.stream()
.map(e -> String.valueOf(e))

.map(Integer::value of)

venkatpullamsetty
Автор

This question was asked in an interview I had.

rakeshsagar
Автор

Stream<String> map = i.stream().map(v->String .valueOf(v));

shaikjareena
Автор

List<Integer> myList=list3.stream().

map(e->Integer.valueOf(e)).
collect(Collectors.toList());

prakashkhulbe
Автор

Hello Naveen sir,

I have acer laptop,
Intel Pentium b969 2.20 ghz processor,
windows 7,
4gb ram...

I cannot buy new laptop..
Can I learn Java, selenium, api web services automation in this .

Please reply sir 🙏🙏

wickedsunny
Автор

Hi Naveen, I am learning this lambda concept. Can you show the same program without lambda concepts.

rajithkumar
Автор

Given Array {"abc", "bca", "cab", "cba", "def", …​} expected o/p = "bca", "abc", "cba" ... can anyone help with this using Streams

ranselynigrel
Автор

list.stream().filter( e -> String.valueOf( e ).startsWith( "2" ) ).toList();

yogidilip
Автор

public class NumberStartWith {
public static void main(String[] args) {
List<Integer> list = Arrays.asList(12, -22, 26, 35, 26, 78, 20, 14, 13, 23);
List<Integer> collect = list.stream().map(e -> String.valueOf(e))
.filter(e -> e.startsWith("2") ||



}
}

ashishsingh
Автор

List<Integer> l = list.stream().filter(n ->

anirudhc
Автор

tried this way :) --> list.stream().filter(integer -> integer.toString().charAt(0) == '2' ||

gktechies.k
Автор

List<Integer> numList4 = new ArrayList<Integer>(
Arrays.asList(213, 215, -250, 250, 32, 24, 43, 57, -39, -212, 113, 34, 45, -2, 144));
-> n.startsWith("2") || n.startsWith("-2"))
-> System.out.println("Number Starts with 2 -->" + n));

sunilkumar-svc
Автор

Stream<Integer> of = Stream.of(2, 203, 240, 2230, 15);
List<Integer> list = -> a.startsWith("2"))
.map(Integer::valueOf)
.toList();


list.forEach(a -> System.out.print(a + " "));

surya
Автор

e->e.startsWith("-2") || e.startsWith("2")

anushreesonawane
join shbcf.ru