diff --git a/mallchat-tools/mallchat-frequency-control/src/main/java/com/abin/frequencycontrol/service/frequencycontrol/GenericMethodWithGenericClass.java b/mallchat-tools/mallchat-frequency-control/src/main/java/com/abin/frequencycontrol/service/frequencycontrol/GenericMethodWithGenericClass.java deleted file mode 100644 index ff8d43b..0000000 --- a/mallchat-tools/mallchat-frequency-control/src/main/java/com/abin/frequencycontrol/service/frequencycontrol/GenericMethodWithGenericClass.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.abin.frequencycontrol.service.frequencycontrol; - -import java.util.function.Supplier; - - public class GenericMethodWithGenericClass { - - public T get(E value, Supplier supplier) throws Throwable { - if (value == null) { - throw new Exception("Error"); - } - try { - return supplier.get(); - } finally { - // 不管成功还是失败,都增加次数 - System.out.println("execute"); - } - } - - // 泛型方法 - public void printArray(E[] array) { - for (E item : array) { - System.out.println(item); - } - } - - - public static void main(String[] args) { - GenericMethodWithGenericClass example = new GenericMethodWithGenericClass<>(); - - Integer[] intArray = {1, 2, 3, 4, 5}; - String[] stringArray = {"Hello", "World"}; - - example.printArray(intArray); - example.printArray(stringArray); - - try { - System.out.println(example.get("hello", Math::random)); - } catch (Throwable e) { - throw new RuntimeException(e); - } - } - }