diff --git a/codes/FixMe.java b/codes/FixMe.java index c30bae8f5ba329e2903c1d90e83da93a1d846f51..1a49b98d50cf589a1e1b2898b1f89fa20a0d3a26 100644 --- a/codes/FixMe.java +++ b/codes/FixMe.java @@ -4,7 +4,7 @@ import java.util.List; public class FixMe { public static void main(String[] args) { // Test the method with different inputs - ArrayList<Integer> list = new ArrayList<>(); + ArrayList<Integer> list = new ArrayList<>; list.add(1); list.add(2); list.add(-1); @@ -15,7 +15,7 @@ public class FixMe { removeNegatives(list); System.out.println(list); - } + /** * The method removes all elements smaller than zero from the list @@ -23,13 +23,13 @@ public class FixMe { */ public static void removeNegatives(ArrayList<Integer> list) { int index = 0; - while (index < list.size()) { + while index < list.size() { int element = list.get(index); if (element > 0) { - list.remove(index); + list.remove(inde); } else { index++; } } } -} \ No newline at end of file +}