From b834aeee5b43abc639795e12045e937188d5b093 Mon Sep 17 00:00:00 2001 From: vincenttrinh3336 <158768889+vincenttrinh3336@users.noreply.github.com> Date: Mon, 29 Apr 2024 22:21:27 +0000 Subject: [PATCH] trying new method --- src/main/java/uta/cse3310/Leaderboard.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/uta/cse3310/Leaderboard.java b/src/main/java/uta/cse3310/Leaderboard.java index b3d2e2c..5c7a096 100644 --- a/src/main/java/uta/cse3310/Leaderboard.java +++ b/src/main/java/uta/cse3310/Leaderboard.java @@ -18,7 +18,7 @@ public void add(String handle, int score) { LB.put(handle, score); scores.add(score); Collections.sort(scores); - if(scores.indexOf(score) > names.size()) + if(scores.indexOf(score) >= names.size()) { names.add(handle); } @@ -36,7 +36,7 @@ public void update(String handle, int score) names.remove(handle); scores.add(new_score); Collections.sort(scores); - if(scores.indexOf(new_score) > names.size()) + if(scores.indexOf(new_score) >= names.size()) { names.add(handle); }