Life is like a Markov chain,
         your future only depends on what you are doing now,
                               and independent of your past.
摘要: 行为参数化,一个处理频繁改变需求的软件开发模式。原则:在编写类似代码之后,尝试将其抽象化。 方法1:为方法增加参数。 方法2:定义一族算法,把它们封装起来(称为"策略"),然后在运行时选择一个算法。 行为参数化:让方法接受多种行为(或战略)作为参数,并在内部使用,来完成不同的行为。 Strategy 阅读全文
posted @ 2018-03-11 23:25 Hu_Yan 阅读(91) 评论(0) 推荐(0) 编辑
摘要: 流是一系列数据项,一次只生成一项。 Java 8新增的编程概念:流处理,通过API来传递代码,函数式编程。 ::语法:"把这个方法作为值"。 函数式编程风格:编写把函数作为一等值的程序。 谓词(Predicate):谓词接受一个参数值,并返回true或false。Predicate<T>是更标准的方 阅读全文
posted @ 2018-03-11 19:37 Hu_Yan 阅读(110) 评论(0) 推荐(0) 编辑
摘要: Collections ArrayList——An indexed sequence that allows shrinks and grows dynamically. LinkedList——An ordered sequence that allows efficient insertion 阅读全文
posted @ 2018-03-11 15:21 Hu_Yan 阅读(184) 评论(0) 推荐(0) 编辑