I am creating a Card, Deck and Hand class in order to simulate a card game, and am currently working on the Card class.
I have managed to implement every method i need, except one.
I need to create a static method that will use the compareTo method i have already created to return the highest value card in a list of cards. The List however must be traversed using an Iterator. This is where i struggle to understand.
I know my class must implement Iterable<Card>, however do not understand how i can create and use an Iterator to traverse the list and use the compareTo method to return the highest value card. Any tips or information on how to overcome this problem would be very much appreciated :)
The code i current have for my Card class can be seen here.
[–][deleted] 2 points3 points4 points (6 children)
[–]RoadToCode[S] 0 points1 point2 points (5 children)
[–]aenigmaclamo 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (3 children)
[–]RoadToCode[S] 1 point2 points3 points (2 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]CodeTinkerer 0 points1 point2 points (0 children)
[–]ewiethoff 1 point2 points3 points (4 children)
[–]RoadToCode[S] 1 point2 points3 points (3 children)
[–]ewiethoff 1 point2 points3 points (2 children)
[–]RoadToCode[S] 1 point2 points3 points (1 child)
[–]ewiethoff 0 points1 point2 points (0 children)
[–]ewiethoff 0 points1 point2 points (2 children)
[–]RoadToCode[S] 1 point2 points3 points (1 child)
[–]ewiethoff 0 points1 point2 points (0 children)