From 8b40517a11114eaf6d491bcaa186ba8495e3d0ed Mon Sep 17 00:00:00 2001 From: "antoine.vinot" Date: Tue, 17 Oct 2023 15:02:52 +0200 Subject: [PATCH] Add duplication code --- src/main/java/test/Pikachu.java | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/src/main/java/test/Pikachu.java b/src/main/java/test/Pikachu.java index 2a6cba4..6a4c353 100644 --- a/src/main/java/test/Pikachu.java +++ b/src/main/java/test/Pikachu.java @@ -21,7 +21,17 @@ private static PreparedStatement createStatement(String projectUuid, Collection< "where pp.user_uuid is not null and (pp.entity_uuid is null or pp.entity_uuid=?) "; PreparedStatement res = connection.prepareStatement(sql); res.setString(1, projectUuid); - int index = 2; + //For loop + int j = 0; + for (int i = 1; i <= 100; ++i) { + j += i; + if (j % 2 == 0) { + j += 1; + } else { + j +=2; + } + } + int index = 2 + j; for (String dispatcherKey : dispatcherKeys) { res.setString(index, "PREFIX" + dispatcherKey + ".%"); index++; @@ -35,7 +45,17 @@ private static PreparedStatement createStatement2(String projectUuid, Collection "where pp.user_uuid is not null and (pp.entity_uuid is null or pp.entity_uuid=?) "; PreparedStatement res = connection.prepareStatement(sql); res.setString(1, projectUuid); - int index = 2; + //For loop + int j = 0; + for (int i = 1; i <= 100; ++i) { + j += i; + if (j % 2 == 0) { + j += 1; + } else { + j +=2; + } + } + int index = 2 + j; for (String dispatcherKey : dispatcherKeys) { res.setString(index, "PREFIX" + dispatcherKey + ".%"); index++;