From 818ed5919f10e8b0d6e7358abc74a1fd7f2413a8 Mon Sep 17 00:00:00 2001 From: Valentyn Kolesnikov Date: Sun, 24 Nov 2024 07:14:28 +0200 Subject: [PATCH] Fixed idea warnings --- .../Solution.java | 2 +- .../g0301_0400/s0400_nth_digit/Solution.java | 2 +- .../Solution.java | 2 +- .../Solution.java | 2 +- .../Solution.java | 2 +- .../FizzBuzz.java | 64 +++++++++++-------- .../CombinationIterator.java | 3 +- .../Solution.java | 2 +- .../Solution.java | 2 +- .../Solution.java | 2 +- .../Solution.java | 2 +- .../Solution.java | 2 +- .../Solution.java | 2 +- .../Solution.java | 2 +- .../Solution.java | 2 +- .../Solution.java | 4 +- .../Solution.java | 2 +- .../s2241_design_an_atm_machine/ATM.java | 2 +- .../Solution.java | 2 +- .../Solution.java | 2 +- .../Solution.java | 4 +- .../Solution.java | 2 +- .../Solution.java | 6 +- .../Solution.java | 2 +- .../Solution.java | 2 +- .../Solution.java | 2 +- .../FizzBuzzTest.java | 10 +-- 27 files changed, 70 insertions(+), 63 deletions(-) diff --git a/src/main/java/g0201_0300/s0282_expression_add_operators/Solution.java b/src/main/java/g0201_0300/s0282_expression_add_operators/Solution.java index 048633149..ace8ac004 100644 --- a/src/main/java/g0201_0300/s0282_expression_add_operators/Solution.java +++ b/src/main/java/g0201_0300/s0282_expression_add_operators/Solution.java @@ -9,7 +9,7 @@ public class Solution { public List addOperators(String num, int target) { List res = new ArrayList<>(); - if (num.length() == 0 || Long.valueOf(num) > Integer.MAX_VALUE) { + if (num.length() == 0 || Long.parseLong(num) > Integer.MAX_VALUE) { return res; } char[] list = num.toCharArray(); diff --git a/src/main/java/g0301_0400/s0400_nth_digit/Solution.java b/src/main/java/g0301_0400/s0400_nth_digit/Solution.java index f6d663caa..b206f4cf2 100644 --- a/src/main/java/g0301_0400/s0400_nth_digit/Solution.java +++ b/src/main/java/g0301_0400/s0400_nth_digit/Solution.java @@ -13,7 +13,7 @@ public int findNthDigit(int n) { long count = 9; int start = 1; while (n > len * count) { - n -= len * count; + n -= (int) (len * count); len += 1; count *= 10; start *= 10; diff --git a/src/main/java/g0401_0500/s0419_battleships_in_a_board/Solution.java b/src/main/java/g0401_0500/s0419_battleships_in_a_board/Solution.java index 24fde3beb..18c246976 100644 --- a/src/main/java/g0401_0500/s0419_battleships_in_a_board/Solution.java +++ b/src/main/java/g0401_0500/s0419_battleships_in_a_board/Solution.java @@ -13,7 +13,7 @@ public int countBattleships(char[][] board) { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { if (board[i][j] != '.' - && (j <= 0 || board[i][j - 1] != 'X') + && (j == 0 || board[i][j - 1] != 'X') && (i <= 0 || board[i - 1][j] != 'X')) { count++; } diff --git a/src/main/java/g0801_0900/s0880_decoded_string_at_index/Solution.java b/src/main/java/g0801_0900/s0880_decoded_string_at_index/Solution.java index fe7be9f8a..c30834aaa 100644 --- a/src/main/java/g0801_0900/s0880_decoded_string_at_index/Solution.java +++ b/src/main/java/g0801_0900/s0880_decoded_string_at_index/Solution.java @@ -15,7 +15,7 @@ public String decodeAtIndex(String s, int k) { } for (int i = s.length() - 1; i >= 0; i--) { char c = s.charAt(i); - k %= length; + k %= (int) length; if (c >= 48 && c <= 57) { length /= c - '0'; } else if (k == 0) { diff --git a/src/main/java/g1001_1100/s1009_complement_of_base_10_integer/Solution.java b/src/main/java/g1001_1100/s1009_complement_of_base_10_integer/Solution.java index 836f64449..b71b70df1 100644 --- a/src/main/java/g1001_1100/s1009_complement_of_base_10_integer/Solution.java +++ b/src/main/java/g1001_1100/s1009_complement_of_base_10_integer/Solution.java @@ -20,7 +20,7 @@ public int bitwiseComplement(int n) { int exp = list.size() - 1; for (int i = list.size() - 1; i >= 0; i--) { if (list.get(i) == 0) { - result += Math.pow(2, exp); + result += (int) Math.pow(2, exp); } exp--; } diff --git a/src/main/java/g1101_1200/s1195_fizz_buzz_multithreaded/FizzBuzz.java b/src/main/java/g1101_1200/s1195_fizz_buzz_multithreaded/FizzBuzz.java index 627efd08f..8765da324 100644 --- a/src/main/java/g1101_1200/s1195_fizz_buzz_multithreaded/FizzBuzz.java +++ b/src/main/java/g1101_1200/s1195_fizz_buzz_multithreaded/FizzBuzz.java @@ -1,61 +1,75 @@ package g1101_1200.s1195_fizz_buzz_multithreaded; -// #Medium #Concurrency #2022_03_03_Time_8_ms_(80.09%)_Space_43.2_MB_(6.17%) +// #Medium #Concurrency #2024_11_24_Time_6_ms_(94.88%)_Space_43.1_MB_(8.61%) -import java.util.concurrent.atomic.AtomicInteger; import java.util.function.IntConsumer; @SuppressWarnings("java:S1130") public class FizzBuzz { - private final AtomicInteger count = new AtomicInteger(1); - private final int n; + private int current; public FizzBuzz(int n) { this.n = n; + this.current = 1; } // printFizz.run() outputs "fizz". public void fizz(Runnable printFizz) throws InterruptedException { - int i; - while ((i = count.get()) <= n) { - if (i % 3 == 0 && i % 5 != 0) { - printFizz.run(); - count.compareAndSet(i, i + 1); + synchronized (this) { + while (current <= n) { + if (current % 3 == 0 && current % 5 != 0) { + printFizz.run(); + current += 1; + notifyAll(); + } else { + wait(); + } } } } // printBuzz.run() outputs "buzz". public void buzz(Runnable printBuzz) throws InterruptedException { - int i; - while ((i = count.get()) <= n) { - count.get(); - if (i % 5 == 0 && i % 3 != 0) { - printBuzz.run(); - count.compareAndSet(i, i + 1); + synchronized (this) { + while (current <= n) { + if (current % 3 != 0 && current % 5 == 0) { + printBuzz.run(); + current += 1; + notifyAll(); + } else { + wait(); + } } } } // printFizzBuzz.run() outputs "fizzbuzz". public void fizzbuzz(Runnable printFizzBuzz) throws InterruptedException { - int i; - while ((i = count.get()) <= n) { - if (i % 15 == 0) { - printFizzBuzz.run(); - count.compareAndSet(i, i + 1); + synchronized (this) { + while (current <= n) { + if (current % 15 == 0) { + printFizzBuzz.run(); + current += 1; + notifyAll(); + } else { + wait(); + } } } } // printNumber.accept(x) outputs "x", where x is an integer. public void number(IntConsumer printNumber) throws InterruptedException { - int i; - while ((i = count.get()) <= n) { - if (i % 5 != 0 && i % 3 != 0) { - printNumber.accept(i); - count.compareAndSet(i, i + 1); + synchronized (this) { + while (current <= n) { + if (current % 3 != 0 && current % 5 != 0) { + printNumber.accept(current); + current += 1; + notifyAll(); + } else { + wait(); + } } } } diff --git a/src/main/java/g1201_1300/s1286_iterator_for_combination/CombinationIterator.java b/src/main/java/g1201_1300/s1286_iterator_for_combination/CombinationIterator.java index e3d1a5c19..ef417d567 100644 --- a/src/main/java/g1201_1300/s1286_iterator_for_combination/CombinationIterator.java +++ b/src/main/java/g1201_1300/s1286_iterator_for_combination/CombinationIterator.java @@ -10,13 +10,12 @@ public class CombinationIterator { private List list; private int index; private int combinationLength; - private boolean[] visited; public CombinationIterator(String characters, int combinationLength) { this.index = 0; this.list = new ArrayList<>(); this.combinationLength = combinationLength; - this.visited = new boolean[characters.length()]; + boolean[] visited = new boolean[characters.length()]; buildAllCombinations(characters, 0, new StringBuilder(), visited); } diff --git a/src/main/java/g1301_1400/s1354_construct_target_array_with_multiple_sums/Solution.java b/src/main/java/g1301_1400/s1354_construct_target_array_with_multiple_sums/Solution.java index 235becf12..417d0fecd 100644 --- a/src/main/java/g1301_1400/s1354_construct_target_array_with_multiple_sums/Solution.java +++ b/src/main/java/g1301_1400/s1354_construct_target_array_with_multiple_sums/Solution.java @@ -21,7 +21,7 @@ public boolean isPossible(int[] target) { || target[maxIndex] % remainingSum == 0) { return false; } - target[maxIndex] %= remainingSum; + target[maxIndex] %= (int) remainingSum; return isPossible(target); } } diff --git a/src/main/java/g1501_1600/s1519_number_of_nodes_in_the_sub_tree_with_the_same_label/Solution.java b/src/main/java/g1501_1600/s1519_number_of_nodes_in_the_sub_tree_with_the_same_label/Solution.java index c255789d7..5d959d74b 100644 --- a/src/main/java/g1501_1600/s1519_number_of_nodes_in_the_sub_tree_with_the_same_label/Solution.java +++ b/src/main/java/g1501_1600/s1519_number_of_nodes_in_the_sub_tree_with_the_same_label/Solution.java @@ -8,7 +8,7 @@ public class Solution { public int[] countSubTrees(int n, int[][] edges, String labelsString) { int[] labelsCount = new int[n]; - if (n <= 0 || edges == null || labelsString == null) { + if (n == 0 || edges == null || labelsString == null) { return labelsCount; } diff --git a/src/main/java/g1601_1700/s1648_sell_diminishing_valued_colored_balls/Solution.java b/src/main/java/g1601_1700/s1648_sell_diminishing_valued_colored_balls/Solution.java index 9d8969faa..bb9119e2c 100644 --- a/src/main/java/g1601_1700/s1648_sell_diminishing_valued_colored_balls/Solution.java +++ b/src/main/java/g1601_1700/s1648_sell_diminishing_valued_colored_balls/Solution.java @@ -18,7 +18,7 @@ public int maxProfit(int[] inventory, int orders) { long diff = i == 0 ? inventory[i] : inventory[i] - inventory[i - 1]; if (count * diff < orders) { totalValue += (2L * inventory[i] - diff + 1) * diff * count / 2 % mod; - orders -= count * diff; + orders -= (int) (count * diff); } else { diff = orders / count; long remainder = orders % count; diff --git a/src/main/java/g1601_1700/s1663_smallest_string_with_a_given_numeric_value/Solution.java b/src/main/java/g1601_1700/s1663_smallest_string_with_a_given_numeric_value/Solution.java index 9b05a99f7..21ffdd4fa 100644 --- a/src/main/java/g1601_1700/s1663_smallest_string_with_a_given_numeric_value/Solution.java +++ b/src/main/java/g1601_1700/s1663_smallest_string_with_a_given_numeric_value/Solution.java @@ -10,7 +10,7 @@ public String getSmallestString(int n, int k) { Arrays.fill(res, 'a'); k -= n; while (k > 0) { - res[--n] += Math.min(25, k); + res[--n] += (char) Math.min(25, k); k -= Math.min(25, k); } return String.valueOf(res); diff --git a/src/main/java/g1701_1800/s1703_minimum_adjacent_swaps_for_k_consecutive_ones/Solution.java b/src/main/java/g1701_1800/s1703_minimum_adjacent_swaps_for_k_consecutive_ones/Solution.java index 96b682dc6..4dac6ad58 100644 --- a/src/main/java/g1701_1800/s1703_minimum_adjacent_swaps_for_k_consecutive_ones/Solution.java +++ b/src/main/java/g1701_1800/s1703_minimum_adjacent_swaps_for_k_consecutive_ones/Solution.java @@ -32,7 +32,7 @@ private long getSum(int[] arr, int l, int h, long[] sum) { int mid = l + (h - l) / 2; int k = h - l + 1; int radius = mid - l; - long res = sum[h + 1] - sum[mid + 1] - (sum[mid] - sum[l]) - (1 + radius) * radius; + long res = sum[h + 1] - sum[mid + 1] - (sum[mid] - sum[l]) - (long) (1 + radius) * radius; if (k % 2 == 0) { res = res - arr[mid] - (radius + 1); } diff --git a/src/main/java/g1801_1900/s1893_check_if_all_the_integers_in_a_range_are_covered/Solution.java b/src/main/java/g1801_1900/s1893_check_if_all_the_integers_in_a_range_are_covered/Solution.java index 0e8b94eb0..4a12f2eba 100644 --- a/src/main/java/g1801_1900/s1893_check_if_all_the_integers_in_a_range_are_covered/Solution.java +++ b/src/main/java/g1801_1900/s1893_check_if_all_the_integers_in_a_range_are_covered/Solution.java @@ -9,7 +9,7 @@ public boolean isCovered(int[][] ranges, int left, int right) { int start = range[0]; int end = range[ranges[0].length - 1]; temp[start] += 1; - temp[end + 1] += -1; + temp[end + 1] -= 1; } for (int i = 1; i < temp.length; i++) { temp[i] += temp[i - 1]; diff --git a/src/main/java/g1901_2000/s1916_count_ways_to_build_rooms_in_an_ant_colony/Solution.java b/src/main/java/g1901_2000/s1916_count_ways_to_build_rooms_in_an_ant_colony/Solution.java index 75188b031..04a185a3b 100644 --- a/src/main/java/g1901_2000/s1916_count_ways_to_build_rooms_in_an_ant_colony/Solution.java +++ b/src/main/java/g1901_2000/s1916_count_ways_to_build_rooms_in_an_ant_colony/Solution.java @@ -46,7 +46,7 @@ private long[] dfs(int root) { long com = 1; for (long[] p : list) { long choose = c(cnt, (int) (p[0])); - cnt -= p[0]; + cnt -= (int) p[0]; com = com * choose; com %= MOD; com = com * p[1]; diff --git a/src/main/java/g2001_2100/s2090_k_radius_subarray_averages/Solution.java b/src/main/java/g2001_2100/s2090_k_radius_subarray_averages/Solution.java index 58925734d..e34a50061 100644 --- a/src/main/java/g2001_2100/s2090_k_radius_subarray_averages/Solution.java +++ b/src/main/java/g2001_2100/s2090_k_radius_subarray_averages/Solution.java @@ -14,7 +14,7 @@ public int[] getAverages(int[] nums, int k) { return res; } long sum = 0; - long range = 2 * k + 1L; + long range = 2L * k + 1L; // take sum of all elements from 0 to k*2 index for (int i = 0; i <= 2 * k; ++i) { sum += nums[i]; diff --git a/src/main/java/g2101_2200/s2104_sum_of_subarray_ranges/Solution.java b/src/main/java/g2101_2200/s2104_sum_of_subarray_ranges/Solution.java index 770e33a7f..fba444e01 100644 --- a/src/main/java/g2101_2200/s2104_sum_of_subarray_ranges/Solution.java +++ b/src/main/java/g2101_2200/s2104_sum_of_subarray_ranges/Solution.java @@ -17,7 +17,7 @@ public long subArrayRanges(int[] nums) { int cur = q.removeLast(); int left = q.peekLast(); int right = i; - sum += 1L * (cur - left) * (right - cur) * nums[cur]; + sum += (long) (cur - left) * (right - cur) * nums[cur]; } q.add(i); } @@ -29,7 +29,7 @@ public long subArrayRanges(int[] nums) { int cur = q.removeLast(); int left = q.peekLast(); int right = i; - sum -= 1L * (cur - left) * (right - cur) * nums[cur]; + sum -= (long) (cur - left) * (right - cur) * nums[cur]; } q.add(i); } diff --git a/src/main/java/g2201_2300/s2231_largest_number_after_digit_swaps_by_parity/Solution.java b/src/main/java/g2201_2300/s2231_largest_number_after_digit_swaps_by_parity/Solution.java index 23b6b8973..2bc93fd5b 100644 --- a/src/main/java/g2201_2300/s2231_largest_number_after_digit_swaps_by_parity/Solution.java +++ b/src/main/java/g2201_2300/s2231_largest_number_after_digit_swaps_by_parity/Solution.java @@ -32,6 +32,6 @@ public int largestInteger(int num) { str[i] = temp; str[swapIndex] = tempStr; } - return Integer.valueOf(new String(str)); + return Integer.parseInt(new String(str)); } } diff --git a/src/main/java/g2201_2300/s2241_design_an_atm_machine/ATM.java b/src/main/java/g2201_2300/s2241_design_an_atm_machine/ATM.java index bba20c7b6..dda24a218 100644 --- a/src/main/java/g2201_2300/s2241_design_an_atm_machine/ATM.java +++ b/src/main/java/g2201_2300/s2241_design_an_atm_machine/ATM.java @@ -35,7 +35,7 @@ public int[] withdraw(int amount) { return new int[] {-1}; } for (int i = 0; i < 5; i++) { - counts[i] += -delivery[i]; + counts[i] -= delivery[i]; } return delivery; } diff --git a/src/main/java/g2201_2300/s2262_total_appeal_of_a_string/Solution.java b/src/main/java/g2201_2300/s2262_total_appeal_of_a_string/Solution.java index b2d2ad8b4..d43a24cb0 100644 --- a/src/main/java/g2201_2300/s2262_total_appeal_of_a_string/Solution.java +++ b/src/main/java/g2201_2300/s2262_total_appeal_of_a_string/Solution.java @@ -13,7 +13,7 @@ public long appealSum(String s) { long res = 0; for (int i = 0; i < len; i++) { int idx = s.charAt(i) - 'a'; - res += (i - lastPos[idx]) * (len - i); + res += (long) (i - lastPos[idx]) * (len - i); lastPos[idx] = i; } return res; diff --git a/src/main/java/g2201_2300/s2288_apply_discount_to_prices/Solution.java b/src/main/java/g2201_2300/s2288_apply_discount_to_prices/Solution.java index b58e1784b..878a0e2a7 100644 --- a/src/main/java/g2201_2300/s2288_apply_discount_to_prices/Solution.java +++ b/src/main/java/g2201_2300/s2288_apply_discount_to_prices/Solution.java @@ -23,7 +23,7 @@ private String applyDiscount(String s, int discount) { return s; } price *= 10; - price += (s.charAt(i) - '0') * (100 - discount); + price += (long) (s.charAt(i) - '0') * (100 - discount); } String stringPrice = String.valueOf(price); if (price < 10) { diff --git a/src/main/java/g2301_2400/s2333_minimum_sum_of_squared_difference/Solution.java b/src/main/java/g2301_2400/s2333_minimum_sum_of_squared_difference/Solution.java index 7f4e6bbf0..e725daa20 100644 --- a/src/main/java/g2301_2400/s2333_minimum_sum_of_squared_difference/Solution.java +++ b/src/main/java/g2301_2400/s2333_minimum_sum_of_squared_difference/Solution.java @@ -33,8 +33,8 @@ public long minSumSquareDiff(int[] nums1, int[] nums2, int k1, int k2) { // if current group has more differences than the totalK, we can only move k of them // to the lower level. if (diffs[i] >= kSum) { - diffs[i] -= kSum; - diffs[i - 1] += kSum; + diffs[i] -= (int) kSum; + diffs[i - 1] += (int) kSum; kSum = 0; } else { // else, we can make this whole group one level lower. diff --git a/src/main/java/g2301_2400/s2342_max_sum_of_a_pair_with_equal_sum_of_digits/Solution.java b/src/main/java/g2301_2400/s2342_max_sum_of_a_pair_with_equal_sum_of_digits/Solution.java index d35d47171..c61d09d9d 100644 --- a/src/main/java/g2301_2400/s2342_max_sum_of_a_pair_with_equal_sum_of_digits/Solution.java +++ b/src/main/java/g2301_2400/s2342_max_sum_of_a_pair_with_equal_sum_of_digits/Solution.java @@ -13,7 +13,7 @@ public int maximumSum(int[] nums) { for (int num : nums) { int s = 0; for (char digit : String.valueOf(num).toCharArray()) { - s += Integer.valueOf(digit - '0'); + s += digit - '0'; } if (!map.containsKey(s)) { map.put(s, num); diff --git a/src/main/java/g2401_2500/s2409_count_days_spent_together/Solution.java b/src/main/java/g2401_2500/s2409_count_days_spent_together/Solution.java index 89e20535d..d987744cf 100644 --- a/src/main/java/g2401_2500/s2409_count_days_spent_together/Solution.java +++ b/src/main/java/g2401_2500/s2409_count_days_spent_together/Solution.java @@ -18,14 +18,14 @@ public int countDaysTogether( Integer endMonth = Integer.valueOf(ends[0]); int res = 0; if (startMonth.equals(endMonth)) { - res += (Integer.valueOf(ends[1]) - Integer.valueOf(starts[1]) + 1); + res += (Integer.parseInt(ends[1]) - Integer.parseInt(starts[1]) + 1); return res; } for (int i = startMonth; i <= endMonth; i++) { if (i == endMonth) { - res += Integer.valueOf(ends[1]); + res += Integer.parseInt(ends[1]); } else if (i == startMonth) { - res += dates[i] - Integer.valueOf(starts[1]) + 1; + res += dates[i] - Integer.parseInt(starts[1]) + 1; } else { res += dates[i]; } diff --git a/src/main/java/g2501_2600/s2528_maximize_the_minimum_powered_city/Solution.java b/src/main/java/g2501_2600/s2528_maximize_the_minimum_powered_city/Solution.java index 45f76f491..b60a6b146 100644 --- a/src/main/java/g2501_2600/s2528_maximize_the_minimum_powered_city/Solution.java +++ b/src/main/java/g2501_2600/s2528_maximize_the_minimum_powered_city/Solution.java @@ -19,7 +19,7 @@ private boolean canIBeTheMinimum(long[] power, long minimum, int k, int r) { if (req > k) { return false; } - k -= req; + k -= (int) req; extraPower[i] += (req); if (i + 2 * r + 1 < n) { extraPower[i + 2 * r + 1] -= (req); diff --git a/src/main/java/g2901_3000/s2930_number_of_strings_which_can_be_rearranged_to_contain_substring/Solution.java b/src/main/java/g2901_3000/s2930_number_of_strings_which_can_be_rearranged_to_contain_substring/Solution.java index bde942f36..e72408c0a 100644 --- a/src/main/java/g2901_3000/s2930_number_of_strings_which_can_be_rearranged_to_contain_substring/Solution.java +++ b/src/main/java/g2901_3000/s2930_number_of_strings_which_can_be_rearranged_to_contain_substring/Solution.java @@ -20,7 +20,7 @@ private long pow(long x, long n, long mod) { public int stringCount(int n) { long mod = (int) 1e9 + 7L; return (int) - (((+pow(26, n, mod) + (((pow(26, n, mod) - (n + 75) * pow(25, n - 1L, mod) + (2 * n + 72) * pow(24, n - 1L, mod) - (n + 23) * pow(23, n - 1L, mod)) diff --git a/src/main/java/g3101_3200/s3186_maximum_total_damage_with_spell_casting/Solution.java b/src/main/java/g3101_3200/s3186_maximum_total_damage_with_spell_casting/Solution.java index 04b17eb65..1925f2c59 100644 --- a/src/main/java/g3101_3200/s3186_maximum_total_damage_with_spell_casting/Solution.java +++ b/src/main/java/g3101_3200/s3186_maximum_total_damage_with_spell_casting/Solution.java @@ -25,7 +25,7 @@ private long smallPower(int[] power, int maxPower) { dp[1] = counts[1]; dp[2] = Math.max(counts[2] * 2L, dp[1]); for (int i = 3; i <= maxPower; i++) { - dp[i] = Math.max(counts[i] * i + dp[i - 3], Math.max(dp[i - 1], dp[i - 2])); + dp[i] = Math.max((long) counts[i] * i + dp[i - 3], Math.max(dp[i - 1], dp[i - 2])); } return dp[maxPower]; } diff --git a/src/test/java/g1101_1200/s1195_fizz_buzz_multithreaded/FizzBuzzTest.java b/src/test/java/g1101_1200/s1195_fizz_buzz_multithreaded/FizzBuzzTest.java index c5f2c3d4e..fc69dbb9c 100644 --- a/src/test/java/g1101_1200/s1195_fizz_buzz_multithreaded/FizzBuzzTest.java +++ b/src/test/java/g1101_1200/s1195_fizz_buzz_multithreaded/FizzBuzzTest.java @@ -39,10 +39,7 @@ void fizzBuzz() throws InterruptedException { new Thread( () -> { try { - fizzBuzz.number( - value -> { - fizz[0]++; - }); + fizzBuzz.number(value -> fizz[0]++); } catch (InterruptedException e) { } }) @@ -82,10 +79,7 @@ void fizzBuzz2() throws InterruptedException { new Thread( () -> { try { - fizzBuzz.number( - value -> { - fizz[0]++; - }); + fizzBuzz.number(value -> fizz[0]++); } catch (InterruptedException e) { } })