Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java I am trying to implements 2 Arraylist methods as recursive versions of them. private E[] data ; /**** assume eveything else is implemented -----
Java
I am trying to implements 2 Arraylist methods as recursive versions of them.
private E[] data;
/**** assume eveything else is implemented
----- indexOf -----
@Override public int indexOf(Object target) { return indexOf(data,target); } private int indexOf(E[] data,Object target){ return 0; }
----- contains-----
@Override public boolean contains(Object target) { boolean found = false; return contains(data,target); } private boolean contains(E data, Object target){ int tracker = 0; if (target == null){ return false; } else if (!target.equals(data)){ return false; }else return contains(data,target); }
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started