OSDN Git Service

perf: delete duplicated loop
authorhizumiaoba <56146205+hizumiaoba@users.noreply.github.com>
Tue, 12 Oct 2021 14:16:31 +0000 (23:16 +0900)
committerhizumiaoba <56146205+hizumiaoba@users.noreply.github.com>
Tue, 12 Oct 2021 14:16:31 +0000 (23:16 +0900)
src/com/ranfa/main/DelesteRandomSelector.java

index cdda4af..c590f9a 100644 (file)
@@ -281,18 +281,14 @@ public class DelesteRandomSelector extends JFrame {
                btnStart.addActionListener(new ActionListener() {
                        public void actionPerformed(ActionEvent e) {
                                Random random = new Random(System.currentTimeMillis());
-                               String[] tmp = new String[property.getSongLimit()];
+                               String paneString = "";
                                integratorArray = new String[property.getSongLimit()];
                                for(int i = 0; i < property.getSongLimit(); i++) {
                                        int randomInt = random.nextInt(selectedSongsList.size());
-                                       tmp[i] = (i + 1) + "曲目: " + selectedSongsList.get(randomInt).getAttribute() + " [" + selectedSongsList.get(randomInt).getDifficulty() + "]「" + selectedSongsList.get(randomInt).getName() + "」!(Lv:" + selectedSongsList.get(randomInt).getLevel() + ")\n\n";
+                                       paneString = paneString + (i + 1) + "曲目: " + selectedSongsList.get(randomInt).getAttribute() + " [" + selectedSongsList.get(randomInt).getDifficulty() + "]「" + selectedSongsList.get(randomInt).getName() + "」!(Lv:" + selectedSongsList.get(randomInt).getLevel() + ")\n\n";
                                        integratorArray[i] = selectedSongsList.get(randomInt).getName() + "(Lv" + selectedSongsList.get(randomInt).getLevel() + ")\n";
                                }
-                               String paneString = "";
-                               for (int i = 0; i < tmp.length; i++) {
-                                       paneString = paneString + tmp[i];
-                               }
-                               paneString = paneString + "この" + tmp.length + "曲をプレイしましょう!!!";
+                               paneString = paneString + "この" + property.getSongLimit() + "曲をプレイしましょう!!!";
                                textArea.setText(paneString);
                                integratorBool = true;
                                LimitedLog.println(this.getClass() + ":[INFO]: " + "show up completed.");