2
동기화 된 블록에 메서드 정의를 넣지 않고 ConcurrentHashMap으로 해결할 수 있는지 궁금하십니까?업데이트를 잃지 않고 장바구니 업데이트
/**
Implement thread-safe updating of user's cart.
Exit criteria is carts is updated atomically, product is appended
in the end of cart.
**/
void addToCart(ConcurrentHashMap<Integer, List<Integer>> carts, Integer userId, Integer productId)