More than 3000 questions in repository. There are more than 900 unanswered questions. Click here and help us by providing the answer. Have a video suggestion. Click Correct / Improve and please let us know.
Core Java - Interview Questions and Answers for 'Filters' - 10 question(s) found - Order By Newest
Q1. Write a Program that gets a set of numbers , filters out the non prime numbers , calculate the factorial of each prime number and then finds the average of all factorials using Lambda expressions
Ans. public class BuggyBread1 {
public static void main(String args[]) {
// Declare and Initialize the Collection
Set<Integer> intSet = new HashSet<Integer>();
// Add Elements
intSet.add(1);
intSet.add(2);
intSet.add(3);
intSet.add(4);
intSet.add(5);
Ans. filter tag speficies the filter name and respective class for handling filter action whereas filter mapping maps the filter to the url patterns ( specifying the url that needs to be intercepted )
Help us improve. Please let us know the company, where you were asked this question :
Q6. Lets say we have a set "set1" with objects of Class A, Class has a non static string called element1, Write a code ( using lambda expression ) to see if there is any object in the set with element1 = "Hello".
Ans. Yes, But with interceptor it will remove the body from the request and then we will have to explicitly add the attributes to the session to forward it to the handler.
Help us improve. Please let us know the company, where you were asked this question :