Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

in java how would i fill out the rest of these for a generics set import java.lang.reflect.Array; import java.util.Collection; import java.util.Iterator; import java.util.Set; public class

in java how would i fill out the rest of these for a generics set import java.lang.reflect.Array; import java.util.Collection; import java.util.Iterator; import java.util.Set; public class Driver implements Set{ private R[] elements; public Driver(Class rClass){ elements= (R[]) Array.newInstance(rClass, 0); } @Override public int size() { return elements.length; } @Override public boolean isEmpty() { return elements.length == 0; } @Override public boolean contains(Object o) { // TODO return false; } @Override public Iterator iterator() { //TODO return null; } @Override public Object[] toArray() { //TODO return new Object[0]; } @Override public boolean add(Object o) { //TODO return false; } @Override public boolean remove(Object o) { //TODO return false; } @Override public boolean addAll(Collection c) { //TODO return false; } @Override public void clear() { ??TODO } @Override public boolean removeAll(Collection c) { //TODO return false; } @Override public boolean retainAll(Collection c) { //TODO return false; } @Override public boolean containsAll(Collection c) { //TODO return false; } @Override public Object[] toArray(Object[] a) { //TODO return new Object[0]; } } 

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

Students also viewed these Databases questions