From 360fe730f4be5cd9e348b6881356694e0b6ae552 Mon Sep 17 00:00:00 2001 From: miiiinju1 Date: Fri, 8 Dec 2023 23:12:10 +0900 Subject: [PATCH] =?UTF-8?q?:bug:=20Fix=20tempCode=20=EC=88=9C=EC=84=9C=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../testDuring/service/TempCodeService.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/swm_nm/morandi/domain/testDuring/service/TempCodeService.java b/src/main/java/swm_nm/morandi/domain/testDuring/service/TempCodeService.java index 11d12fa8..ac193a44 100644 --- a/src/main/java/swm_nm/morandi/domain/testDuring/service/TempCodeService.java +++ b/src/main/java/swm_nm/morandi/domain/testDuring/service/TempCodeService.java @@ -66,12 +66,15 @@ public List getTempCode(Tests test) Map tempCodes = hashOps.entries(tempCodeKey); - return tempCodes.keySet().stream().map(problemNumber-> TestCodeDto.builder() - .cppCode(tempCodes.get(problemNumber).getCppCode()) - .pythonCode(tempCodes.get(problemNumber).getPythonCode()) - .javaCode(tempCodes.get(problemNumber).getJavaCode()) - .problemNumber(Integer.parseInt(problemNumber)) - .build()).collect(Collectors.toList()); + return tempCodes.entrySet().stream() + .sorted(Map.Entry.comparingByKey()) + .map(entry -> TestCodeDto.builder() + .cppCode(entry.getValue().getCppCode()) + .pythonCode(entry.getValue().getPythonCode()) + .javaCode(entry.getValue().getJavaCode()) + .problemNumber(Integer.parseInt(entry.getKey())) + .build()) + .collect(Collectors.toList()); } public PracticeProblemCodeDto getPracticeProblemTempCode(Long practiceProblemId) {