摘要: 1. FlowPanel 普通容器 1 //普通的容器,使用HTML默认的布局行为 2 FlowPanel flowPanel = new FlowPanel(); 3 flowPanel.add(new Label("flowPanel")); 4 flowPanel.add(new Label( 阅读全文
posted @ 2021-07-10 11:08 一穷三白 阅读(235) 评论(0) 推荐(0)
摘要: 1. Exchanger 用于线程之间的数据交换 //生产者生产出固定的数量后与消费者的产品容器进行交换 class Producer implements Runnable{ private Queue<String> products; private Exchanger<Queue> exch 阅读全文
posted @ 2021-06-29 11:09 一穷三白 阅读(61) 评论(0) 推荐(0)
摘要: 1. CountDownLatch 用于线程计时,完成操作后通过countDownLatch.countDown() 就能让计时减一,直到计时为零之后,执行countDownLatch.await() 后的代码,否则阻塞。 1 class MainThread implements Runnable 阅读全文
posted @ 2021-06-29 10:06 一穷三白 阅读(131) 评论(0) 推荐(0)
摘要: 阅读全文
posted @ 2021-06-28 13:05 一穷三白 阅读(104) 评论(0) 推荐(0)
摘要: 1. 可以为枚举类添加私有字段,以及私有构造函数 1 enum MyEnum{ 2 ONE("one"),TWO("two"),THREE("three"); 3 4 private String msg; 5 6 private MyEnum(String msg){ 7 this.msg = m 阅读全文
posted @ 2021-06-27 10:31 一穷三白 阅读(132) 评论(0) 推荐(0)
摘要: 基本部件 1 //标签 2 Label label = new Label("label"); 3 //html 4 HTML html = new HTML("<div style='width:100px;height:100px;background:red'></div>"); 5 //图片 阅读全文
posted @ 2021-06-21 10:00 一穷三白 阅读(145) 评论(0) 推荐(0)
摘要: Buffer由数据和可以高效地访问以及操纵这些数据的四个索引组成,分别是mark(标记),position(位置),limit(界限),capacity(容量) capacity() 返回缓冲区容量 clear() 清空缓冲区,将position设置为0,limit设置为容量,可以调用此方法覆写缓冲 阅读全文
posted @ 2021-06-20 10:55 一穷三白 阅读(299) 评论(0) 推荐(0)
摘要: 古怪循环泛型:创建一个类的时候,其所继承的泛型类接受当前所创建的类的类型作为参数。 1 interface GenericGetter<T>{ 2 T get(); 3 } 4 5 interface Getter extends GenericGetter<Getter>{} 自限定:将当前创建的 阅读全文
posted @ 2021-06-18 19:30 一穷三白 阅读(161) 评论(0) 推荐(0)
摘要: 引自:(8条消息) Java 泛型,你了解类型擦除吗?_frank 的专栏-CSDN博客_java泛型擦除 阅读全文
posted @ 2021-06-16 17:13 一穷三白 阅读(37) 评论(0) 推荐(0)
摘要: //饿汉式 class Single1{ private static final Single1 instance = new Single1(); private Single1(){} public static Single1 getInstance() { return instance; 阅读全文
posted @ 2021-06-16 15:38 一穷三白 阅读(80) 评论(0) 推荐(0)