Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone help me please? were using java , if possible attach a screenshoot of your code. * Exercise from Chapter 10 slide 28: *

Can someone help me please? were using java , if possible attach a screenshoot of your code. image text in transcribed
image text in transcribed
* Exercise from Chapter 10 slide 28: * We start with a working client that will test the method's operation. * Task: * Write a method, intersect, that accepts two sorted array lists of integers * as parameters and returns a new list that contains only the elements that * are found in both lists. import java.util.*; public class ListExercise { public static void main (String[] args) { List list1 = Arrays.asList(1, 4, 8, 9, 11, 15, 17, 28, 41, 59); List list2 = Arrays.asList (4, 7, 11, 17, 19, 20, 23, 28, 37, 59, 81); System.out.println("listi: " + listi); System.out.println("list2: " + list2); // System.out.println("intersect(listi, list2): " + intersect(listi, list2)); } } Exercise Write a method intersect that accepts two sorted array lists of integers as parameters and returns a new list that contains only the elements that are found in both lists. Example: if lists named list1 and list2 initially store: [1, 4, 8, 9, 11, 15, 17, 28, 41, 59] [4, 7, 11, 17, 19, 20, 23, 28, 37, 59, 81] Then the call of intersect (listi, list2) returns the list: [4, 11, 17, 28, 59]

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Microsoft SQL Server 2014 Integration Services

Authors: Brian Knight, Devin Knight

1st Edition

1118850904, 9781118850909

More Books

Students also viewed these Databases questions

Question

How do modern Dashboards differ from earlier implementations?

Answered: 1 week ago