package algoLike.push; import java.util.*; import java.util.stream.Collectors; import javax.ws.rs.*; import javax.ws.rs.client.*; import javax.ws.rs.core.*; import org.springframework.stereotype.Component; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.core.JsonProcessingException; @Path("/loseA") @Component public class LoseA { private boolean value; @PUT public void updateHandsA(@FormParam("handsA") List<String> handsA_json) throws JsonProcessingException { List<Map.Entry<Integer, Boolean>> handsA = new ArrayList<>(); for (String str: handsA_json) { Map<Integer, Boolean> i = new ObjectMapper().readValue(str, HashMap.class); handsA.add(i.entrySet().iterator().next()); } this.value = (handsA.stream().filter(item -> item.getValue()==false).collect(Collectors.toList()).size()==0); } @Produces(MediaType.APPLICATION_JSON) @GET public boolean getValue() { return value; } }