You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
622 B
20 lines
622 B
public class TestMain {
|
|
public static void main(String[] args) {
|
|
// 测试 Pair
|
|
Pair<String, Integer> pair = new Pair<>("年龄", 20);
|
|
System.out.println("原来:" + pair);
|
|
|
|
Pair<Integer, String> afterSwap = Pair.swap(pair);
|
|
System.out.println("交换后:" + afterSwap);
|
|
|
|
// 测试 Cache
|
|
System.out.println("\n=== 测试缓存 ===");
|
|
Cache<String, Integer> cache = new Cache<>();
|
|
|
|
cache.put("语文", 90);
|
|
cache.put("数学", 95);
|
|
|
|
System.out.println("获取语文:" + cache.get("语文"));
|
|
cache.printAll();
|
|
}
|
|
}
|