Created
May 10, 2018 01:28
-
-
Save xujiaji/f8dbb667e675353e4927a2e608e89ac1 to your computer and use it in GitHub Desktop.
Java中通过反射应用潜在类型机制
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class Apply | |
| { | |
| public static <T, S extends Iterable<? extends T>> | |
| void apply(S seq, Method f, Object ... args) | |
| { | |
| try | |
| { | |
| for(T t : seq) | |
| { | |
| f.invoke(t, args); | |
| } | |
| } catch (Exception e) | |
| { | |
| throw new RuntimeException(e); | |
| } | |
| } | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
使用