摘要: Timer 和 ScheduledExecutorSeruvce 都能执行定时的循环任务,有函数 scheduleAtFixedRate。但是,如果任务运行时间较长,超过了一个周期时长,下一个任务就会被延缓执行。例如代码: 1 public class ScheduledRunnableTest e... 阅读全文
posted @ 2014-07-31 13:16 徐软件 阅读(1266) 评论(0) 推荐(0) 编辑
摘要: 昨天写 Scala 的时候,使用 match(相当于 switch)时,运行结果很奇怪。 1 var i: Int = 0 2 while (i println("offset: " + items(i)) 5 case logSize => println("logSize: " + i... 阅读全文
posted @ 2014-07-31 09:56 徐软件 阅读(427) 评论(0) 推荐(0) 编辑
摘要: 代码:1 String str = "the music made it hard to concentrate";2 String delims = "[ ]+";3 String[] tokens = str.split(delims);结果为:the, musi... 阅读全文
posted @ 2014-07-31 09:52 徐软件 阅读(5137) 评论(0) 推荐(0) 编辑