Skip to content

Commit 63fd91d

Browse files
committed
Fix reviews
1 parent a72dec9 commit 63fd91d

File tree

2 files changed

+12
-23
lines changed

2 files changed

+12
-23
lines changed

src/main/java/com/thealgorithms/datastructures/bloomfilter/BloomFilter.java

Lines changed: 12 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -128,28 +128,18 @@ private static class Hash<T> {
128128
* @return the computed hash value
129129
*/
130130
public int compute(T key) {
131-
String keyString;
132-
if (key instanceof Object[] objectArray) {
133-
keyString = Arrays.deepToString(objectArray);
134-
} else if (key instanceof int[] intArray) {
135-
keyString = Arrays.toString(intArray);
136-
} else if (key instanceof long[] longArray) {
137-
keyString = Arrays.toString(longArray);
138-
} else if (key instanceof double[] doubleArray) {
139-
keyString = Arrays.toString(doubleArray);
140-
} else if (key instanceof float[] floatArray) {
141-
keyString = Arrays.toString(floatArray);
142-
} else if (key instanceof boolean[] booleanArray) {
143-
keyString = Arrays.toString(booleanArray);
144-
} else if (key instanceof byte[] byteArray) {
145-
keyString = Arrays.toString(byteArray);
146-
} else if (key instanceof char[] charArray) {
147-
keyString = Arrays.toString(charArray);
148-
} else if (key instanceof short[] shortArray) {
149-
keyString = Arrays.toString(shortArray);
150-
} else {
151-
keyString = String.valueOf(key);
152-
}
131+
String keyString = switch (key) {
132+
case Object[] arr -> Arrays.deepToString(arr);
133+
case int[] arr -> Arrays.toString(arr);
134+
case long[] arr -> Arrays.toString(arr);
135+
case double[] arr -> Arrays.toString(arr);
136+
case float[] arr -> Arrays.toString(arr);
137+
case boolean[] arr -> Arrays.toString(arr);
138+
case byte[] arr -> Arrays.toString(arr);
139+
case char[] arr -> Arrays.toString(arr);
140+
case short[] arr -> Arrays.toString(arr);
141+
case null, default -> String.valueOf(key);
142+
};
153143
return index * asciiString(keyString);
154144
}
155145

src/main/java/com/thealgorithms/others/SkylineProblem.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
package com.thealgorithms.others;
32

43
import java.util.ArrayList;

0 commit comments

Comments
 (0)