Showing posts from February, 2024

Program to find the occurrences of numbers in an array.

Problem:- Program to find the occurrences of numbers in an array. Input:-  {0, 1, 0, 3, 5, 4, 2, 1, 3} Output:-  0    ---->2 1    ---->2 3    ---->2 5    ---->1 4    ---->1 2    ---->1 Solution:-  package c…

Find the longest common prefix from the String array.

Problem:- Find the longest common prefix from the String array.  Input:-   { "javaprogramming" , "javadeveloper" , "javaprogrammer" , "javaarchitect" } Output:- java                        …

Program to find the sum of Integers from List.

Problem:- Program to find the sum of Integers from List.     package com.codeforsolution.logical.java8; import java.util.Arrays; import java.util.List; public class FindSumOfIntegers { public static void main(String[] args…

Find string or numbers using Start with and Contains

Problem:- Find all the numbers starting with 1 using Stream functions from the given list of integers? Solution:- package com.codeforsolution.logical.java8; import java.util.Arrays; import java.util.List; public class Number…

How to Iterate a HashMap in Java?

How to Iterate a HashMap in Java? There are many ways to iterate a HashMap in Java. Using an Iterator to iterate a HashMap. package com.codeforsolution.logical.java8; import java.util.HashMap; import java.util.Iterator; import …

Write a program to find the maximum number.

Problem :-   Write a program to find the maximum number using Java 8 Java code:- package com.codeforsolution.logical.java8; import java.util.Arrays; import java.util.Comparator; import java.util.List; public class FindMax…

Count the number of occurrences using Java8?

Problem :- How to count the number of occurrences of an element in a List using Java 8 Java code:- package com.codeforsolution.java8; /*//Write a program to count the number of occurrences of an elements in a list. * */ packag…

Load More
That is All