Thinking in Java
erizhu
这个作者很懒,什么都没留下…
展开
-
Java 泛型-简单泛型存储多种类型对象
package generic;public class DemoClass1 { public DemoClass1() { System.out.println("DemoClass1"); } @Override public String toString() { // TODO Auto-gene翻译 2018-01-24 00:51:57 · 1456 阅读 · 0 评论 -
Java 泛型-实现对象列表
package generic;import java.util.ArrayList;import java.util.List;import java.util.Random;public class RandomList { private List storage = new ArrayList(); private Random rand = new Random(翻译 2018-01-28 01:13:24 · 1483 阅读 · 0 评论 -
Java泛型接口——工厂模式类生成器
package generic.interfaces;public interface Generator { T next();}package generic.interfaces;public class Coffee { private static long counter = 0; private final long id = c翻译 2018-01-28 01:13:15 · 1713 阅读 · 0 评论 -
Java泛型+适配器模式实现Fibonacci
package generic.interfaces;public interface Generator { T next();}package generic.interfaces;import java.util.Iterator;public class IterableFibnacci implements Generator翻译 2018-01-28 01:13:06 · 606 阅读 · 0 评论 -
Java泛型--泛型方法与可变参数
package generic;import java.util.ArrayList;import java.util.Collection;import java.util.Collections;import java.util.List; public class GenericMethods { //泛型方法 public static v翻译 2018-01-28 01:12:57 · 1915 阅读 · 0 评论 -
Java泛型--通用类生成工具
package generic.interfaces;public interface Generator { T next();}package generic.interfaces;public class BasicGenerator implements Generator { private Class type; pub翻译 2018-01-28 01:12:48 · 1131 阅读 · 0 评论 -
Java泛型--set实用工具
package generic;import java.util.HashSet;import java.util.Set;import org.apache.poi.ss.formula.functions.T;public class Sets { // 并集 public static Set union(Set... args) {翻译 2018-01-28 01:12:38 · 314 阅读 · 0 评论 -
Java 泛型-实现堆栈
package generic;public class LinkedStack { private static class Node { U item; Node nextNode; Node() { item = null; nextNode = null;翻译 2018-01-24 00:52:17 · 411 阅读 · 0 评论 -
Java 泛型-元组
package generic;public class TwoTuple { public final A first; public final B second; public TwoTuple(A first, B second) { this.first = first; this.second = secon翻译 2018-01-24 00:52:07 · 390 阅读 · 0 评论