Give the names of the two methods that we have to have to implement interface Iterator as shown in RED below.

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

Give the names of the two methods that we have to have to implement interface Iterator as shown in RED below.

Post by answerhappygod »

Give the names of the two methods that we have to have to
implement interface Iterator <Student> as shown
in RED below.
Give The Names Of The Two Methods That We Have To Have To Implement Interface Iterator Student As Shown In Red Below 1
Give The Names Of The Two Methods That We Have To Have To Implement Interface Iterator Student As Shown In Red Below 1 (151.67 KiB) Viewed 50 times
Enhanced for loop requires some effort. We have to do some work (making class iterable) before you can use it. Suppose we have the following collection class Roster that contains members of class Student. public class Roster { private int maxEnrolled; private int maxWaitlist; private int totalwithhope; private TreeSet<Student> enrolled; private ArrayList<Student> waitList; private HashSet<Student> hoping; } To make class Roster to be iterable, we can add an inner class Rosterlterator that implements Iterator <Student>. Give the names of the two methods that we have to have to implement interface Iterator <Student> as shown in RED below. B public class Roster implements Iterable<Student> { public Iterator<Student> iterator() { return new RosterIterator; } private class RosterIterator implements Iterator<Student> { public boolean A___O { }; public Student _B___O {...}; } }
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply