Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Latest commit

 

History

History
History
31 lines (24 loc) · 746 Bytes

File metadata and controls

31 lines (24 loc) · 746 Bytes
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.util.ArrayList;
import java.util.List;
/**
* Created by riven_chris on 15/7/9.
*/
public class ArrayMaker<T> {
private Class<T> kind; // 类型标签
public ArrayMaker(Class<T> kind) {
this.kind = kind;
}
List<T> create(int size) {
// return (T[]) Array.newInstance(kind, size);
return new ArrayList<T>();
}
public <K> List<K> m() {
return new ArrayList<K>();
}
public static void main(String[] args) {
ArrayMaker<Integer> stringMaker = new ArrayMaker<Integer>(Integer.class);
// Integer[] stringArray = stringMaker.create(9);
// System.out.println(Arrays.toString(stringArray));
List<Integer> list = stringMaker.create(9);
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.