MCPcopy Index your code
hub / github.com/careercup/ctci / dealHand

Method dealHand

java/Chapter 8/Question8_1/Deck.java:32–48  ·  view source on GitHub ↗
(int number)

Source from the content-addressed store, hash-verified

30 }
31
32 public T[] dealHand(int number) {
33 if (remainingCards() < number) {
34 return null;
35 }
36
37 T[] hand = (T[]) new Card[number];
38 int count = 0;
39 while (count < number) {
40 T card = dealCard();
41 if (card != null) {
42 hand[count] = card;
43 count++;
44 }
45 }
46
47 return hand;
48 }
49
50 public T dealCard() {
51 if (remainingCards() == 0) {

Callers

nothing calls this directly

Calls 2

remainingCardsMethod · 0.95
dealCardMethod · 0.95

Tested by

no test coverage detected