package net.gemelen.blackjack.data;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class PlayerRecordView {
    private int id;
    private List<Hand> hands;

    public PlayerRecordView(int id) {
        this.id = id;
    }

    public PlayerRecordView(PlayerRecord record) {
        System.out.println("PlayerRecordView");
        this.id = record.getId();
        System.out.println("PlayerRecordView: " + record.getId());
        System.out.println("PlayerRecordView: " + record.getHands());
        this.hands = new ArrayList<>(record.getHands() == null ? 0 : record.getHands().size());
        if (record.getHands() != null ) {
            Collections.copy(this.hands, record.getHands());
        }
        System.out.println("PlayerRecordView: " + (record.getHands() == null ? 0 : record.getHands().size()));
        System.out.println("PlayerRecordView.");
        // if player is dealer then we should fake his first card with CARDS,HOLECARD in shared players list
    }

    public List<Hand> getHands() {
        return hands;
    }

    public void setHands(List<Hand> hands) {
        this.hands = hands;
    }

    public Hand getHandById(int handId) {
        Hand current = null;
        for (Hand hand : hands) {
            if (hand.getHandId() == handId) {
                current = hand;
            }
        }

        return current;
    }
}

@@ -325,216 +325,31 @@
     
-System.out.println(%22PlayerRecordView%22);%0A        this.id = record.getId();%0A        System.out.println(%22PlayerRecordView: %22 + record.getId());%0A        System.out.println(%22PlayerRecordView: %22 + record.getHands()
+this.id = record.getId(
 );%0A 
@@ -542,24 +542,24 @@
 etHands());%0A
+
         %7D%0A  
@@ -560,168 +560,8 @@
   %7D%0A
-        System.out.println(%22PlayerRecordView: %22 + (record.getHands() == null ? 0 : record.getHands().size()));%0A        System.out.println(%22PlayerRecordView.%22);%0A
     

clean output