Below is the purpose of my learning that I have started it, but I do not know how to implement the program in the main Where to go from here I appreciate any help!
Objective:
- Add an Iterator object to the card collection
- Iterators have a personalized internal
- Types that are suitable
- To calculate the time of collection and change, the calculator and Iterators use a large number.
-
Expand the appropriate sections for the correct methods, the interface, and a class corresponding to the Java API.
Public class cardcrolling {Private array list & lt; Card & gt; Leaves; Private Arrestist & lt; Note & gt; notes; Public CardColling () {// Constructor introduces two simplified cards = new arrelisted & lt; Cards & gt; (); Notes = New Arrestists & lt; Note & gt; (); } Private class card implies Iterable & lt; Card & gt; {// Inner Class Public Iterator & lt; Card & gt; Iterator () {// Create an Iterator for card return card. Director (); }} Private Class Notes uses the Iterable & lt; Note & gt; {// Inner Class Public Iterator & lt; Note & gt; Iterator () {// Note: Make an Iterator for return notes. Dictionary (); }} Public card card () {new card back (); } Public Note Notes () {New Note (); } Add Public Zero (Card Card) {cards.add (cards); } Add Public Zero (note note) {notes.add (note); }}
You have two concepts That is, you can mix if you can iterate on some internal elements, then if one item is ineligible.
So if I have a shopping cart with goods, then I can change my groceries.
Applies to the public class shoppingcart iterable & lt; GroceryItem & gt; {Public Eaterware & lt; CareerITM & gt; Iterator () {// An Iterator Return}}
Therefore, to use this functionality, I must provide an Iterator. In the example of your code, you are reusing the Iterator from Array List. From your exercise details, I believe that you need to implement yourself, for example:
public grade grass erater otterrator & lt; CareerITM & gt; {Personal groceries [] items; Private Ent Operent Element = 0; Public groceryटर (groceries [] items) {this.items = items; } Public Grocery Idam Next () // Implementation of this Public Zero Extraction () // Apply this Public Boolean Next () // This implementation}
Then I sorta you the manufacturer's With a hint / member variables after making this class, your intra-class class (my shopping cart) will return to my new Iterator.
The assignment recommends using a private inner class for your custom cutter.
Good luck
Comments
Post a Comment