Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

I need help with this Java question. Please provide an output to FancyArray.java if possible. Add the following two methods to the FancyArray> class: -

I need help with this Java question. Please provide an output to FancyArray.java if possible.

image text in transcribed

Add the following two methods to the FancyArray> class: - public int indexOf(E e): returns the index of the first occurrence of e in this FancyArray; if e does not occur in this FancyArray, returns -1. - public int lastIndexOf(E e): returns the index of the last occurrence of e in this FancyArray; if e does not occur in this FancyArray, returns -1. For example, if fa is a FancyArray representing [5,10,15,10,20], then: - fa.indexOf(10) should be 1 - fa.lastlndexOf(10) should be 3 - fa.indexOf(25) should be 1 - fa.lastlndexOf(25) should be 1 Note: If you wish, you can make the parameter type be Object instead of E. It doesn't really matter for this exercise. Note: do not use ArrayList (or any other kind of List or Collection) in the FancyArray class. Additional Notes: Regarding your code's standard output, CodeLab will check for case errors but will ignore whitespace (tabs, spaces, newlines) altogether

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_2

Step: 3

blur-text-image_3

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

Introduction To Data Mining

Authors: Pang Ning Tan, Michael Steinbach, Vipin Kumar

1st Edition

321321367, 978-0321321367

More Books

Students explore these related Databases questions

Question

Bring out the limitations of planning.

Answered: 3 weeks ago