Writ a static method `countSuit` that takes a hand (as an ArrayList) of cards as well as
Question:
Writ a static method `countSuit` that takes a hand (as an ArrayList) of cards as well as a suit name (as a string) as input, and that returns the number of cards in the hand that have the named suit.
Writ a static method `isFlush` that takes a hand (as an ArrayList) of cards as input, and that returns `true` if all the cards in the hand are the same suit. Otherwise, it should return `false`.
Writ a static method `hasPair` that takes a hand (as an ArrayList) of cards as input, and that returns `true` if there is any pair of cards in the hand that have the same rank.
Writ a static method `swapAdjacent` that takes an ArrayList of an EVEN number of integers as input, and that updates this list by swapping the locations of each pair of adjacent elements. e.g. if `list` has string representation [3, 7, 12, 9, 4, 8],then `swapAdjacent(list)` should update `list` to have string representation [7, 3, 9, 12, 8, 4].
Writ a static method `removeRepetition` that takes an ArrayList of integers as input, and that returns a new ArrayList that contains the same elements as the input, except all ADJACENT repetition has been removed e.g. if `list` has string representation [3, 4, 4, 6, 4, 3, 3, 3, 1, 1],Then `removeRepetition(list)` should return the new list with string representation [3, 4, 6, 4, 3, 1].
Java An Introduction To Problem Solving And Programming
ISBN: 9780134462035
8th Edition
Authors: Walter Savitch