mirror of
https://github.com/sjsdfg/effective-java-3rd-chinese.git
synced 2025-02-13 21:10:19 +08:00
68 lines
1.4 KiB
Plaintext
68 lines
1.4 KiB
Plaintext
|
public class Solo<T> {}
|
||
|
Solo<Integer> val = new Solo<Integer>();
|
||
|
Duo<Double, Character> dual = new Duo<Double, Character>(12.2585, 'C');
|
||
|
|
||
|
----------------------------------------------------
|
||
|
|
||
|
[
|
||
|
["keyword", "public"],
|
||
|
["keyword", "class"],
|
||
|
["class-name", "Solo"],
|
||
|
["generics", [
|
||
|
["punctuation", "<"],
|
||
|
["class-name", "T"],
|
||
|
["punctuation", ">"]
|
||
|
]],
|
||
|
["punctuation", "{"],
|
||
|
["punctuation", "}"],
|
||
|
|
||
|
["class-name", "Solo"],
|
||
|
["generics", [
|
||
|
["punctuation", "<"],
|
||
|
["class-name", "Integer"],
|
||
|
["punctuation", ">"]
|
||
|
]],
|
||
|
" val ",
|
||
|
["operator", "="],
|
||
|
["keyword", "new"],
|
||
|
["class-name", "Solo"],
|
||
|
["generics", [
|
||
|
["punctuation", "<"],
|
||
|
["class-name", "Integer"],
|
||
|
["punctuation", ">"]
|
||
|
]],
|
||
|
["punctuation", "("],
|
||
|
["punctuation", ")"],
|
||
|
["punctuation", ";"],
|
||
|
|
||
|
["class-name", "Duo"],
|
||
|
["generics", [
|
||
|
["punctuation", "<"],
|
||
|
["class-name", "Double"],
|
||
|
["punctuation", ","],
|
||
|
["class-name", "Character"],
|
||
|
["punctuation", ">"]
|
||
|
]],
|
||
|
" dual ",
|
||
|
["operator", "="],
|
||
|
["keyword", "new"],
|
||
|
["class-name", "Duo"],
|
||
|
["generics", [
|
||
|
["punctuation", "<"],
|
||
|
["class-name", "Double"],
|
||
|
["punctuation", ","],
|
||
|
["class-name", "Character"],
|
||
|
["punctuation", ">"]
|
||
|
]],
|
||
|
["punctuation", "("],
|
||
|
["number", "12.2585"],
|
||
|
["punctuation", ","],
|
||
|
["string", "'C'"],
|
||
|
["punctuation", ")"],
|
||
|
["punctuation", ";"]
|
||
|
]
|
||
|
|
||
|
----------------------------------------------------
|
||
|
|
||
|
Checks for generics.
|