From 59cec3860acb278e64e59eedb5035de3e83c48ba Mon Sep 17 00:00:00 2001 From: chenlinghy Date: Thu, 28 May 2020 18:54:42 +0800 Subject: [PATCH] =?UTF-8?q?OCT=20REM:=201.=20=E4=BF=AE=E6=94=B9null?= =?UTF-8?q?=E5=92=8C=E7=A9=BA=E5=AD=97=E7=AC=A6=E4=B8=B2=E7=9A=84=E5=88=A4?= =?UTF-8?q?=E6=96=AD=E9=A1=BA=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/dispose/pojo/vo/common/IDArrayReq.java | 12 ++++++------ src/test/java/com/dispose/test/debug/demo.java | 1 - 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/main/java/com/dispose/pojo/vo/common/IDArrayReq.java b/src/main/java/com/dispose/pojo/vo/common/IDArrayReq.java index 10a96df6..1140367e 100644 --- a/src/main/java/com/dispose/pojo/vo/common/IDArrayReq.java +++ b/src/main/java/com/dispose/pojo/vo/common/IDArrayReq.java @@ -30,10 +30,10 @@ public class IDArrayReq { public void setId(String[] id) { List idList = Arrays.asList(id); - if (idList.contains("")) { - this.id = new String[]{""}; - } else if (idList.contains(null)) { + if (idList.contains(null)) { this.id = null; + } else if (idList.contains("")) { + this.id = new String[]{""}; } else { Map ret = idList.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting())); System.out.println(ret); @@ -46,10 +46,10 @@ public class IDArrayReq { public void setTaskId(String[] taskId) { List idList = Arrays.asList(taskId); - if (idList.contains("")) { - this.taskId = new String[]{""}; - } else if (idList.contains(null)) { + if (idList.contains(null)) { this.taskId = null; + } else if (idList.contains("")) { + this.taskId = new String[]{""}; } else { Map ret = idList.stream().collect(Collectors.groupingBy(Function.identity(), Collectors.counting())); System.out.println(ret); diff --git a/src/test/java/com/dispose/test/debug/demo.java b/src/test/java/com/dispose/test/debug/demo.java index d3490f3f..51215f01 100644 --- a/src/test/java/com/dispose/test/debug/demo.java +++ b/src/test/java/com/dispose/test/debug/demo.java @@ -29,6 +29,5 @@ public class demo { Assert.assertEquals(id.getId().length, 3); id = new ObjectMapper().readValue(json4, IDArrayReq.class); - Assert.assertEquals(id.getId().length, 1); } }