Question: solve this pls TASK 2: Analyse the following Java code in Figure 1 and 2. Rewrite the given program code using logic programming paradigm, Prolog.

solve this pls solve this pls TASK 2: Analyse the following Java code in Figure

TASK 2: Analyse the following Java code in Figure 1 and 2. Rewrite the given program code using logic programming paradigm, Prolog. Your solution should include recursive concept and demonstrate the query sample. Part 1: import java.util.* import java.util.stream.Collectors: public class Filter { public static List Number> apply List Number Ist, Double target){ return ist.stream) .mapToDoublel Number::doublevalue) .filteri elen > elem > target ) .boxed() collecti Collectors.tocollection ArrayList:: new ) ); } public static void main(String[] args) { // Integer Il nums = new Integer () {1,2,3,4,5,6,7,8,9); Doublell nums = new Doublell (2.1,3.2.4.3,5.4,6.5,7.6,8.7): System.out.println Filter.apply( Arrays.aslist(nums), 5.0 ) > Figure 1: Filter the numeric elements based on target value Part 2: import java.util.*; import java.util.stream.*; public class Demo public static void main(String!] args) { String 1 Ist = { }; Stream String[]> stream = Arrays.strean(Ist); System.out.println( stream flatMaplarr -> Arrays.stream(arr) collecti Collectors.toCollection Linkedlist:: new ) ) Figure 2: Joining the elements from the array objects as a collection of objects

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!