Java中的可變長參數可以這樣表示:String...args而其與String s(即單參數)方法的多態性成了一個很有意思的問題。package cn.xujin;public class Regex2{public static void main(String args[]){Base a = new Child();a.test("one");//Base//a.test("22","123");//error,編譯錯誤Child b = (Child)a;b.test("one");/
之前我寫過的一片博文講過了散列表(Hash Table),而散列表可以用來實現散列集(HashSet)和散列映射表(HashMap)。HashSetHashSet<T>類有四種建構函式:Constructor and DescriptionHashSet()Constructs a new, empty set; the backing HashMap instance has default initial capacity (16) and load factor (0.75).
Java集合類庫將集合的介面與實現分離。同樣的介面,可以有不同的實現。Java集合類的基本介面是Collection介面。而Collection介面必須實現Iterator介面。以表示集合架構的介面,java.lang以及java.util兩個包裡的。紅色字型部分是OCJP考綱要求的介面。其他部分可以從左向右看,比如Collection的Subinterfaces有List,Set以及Queue等。Iterator介面Iterator介面包含三個方法: public interface
映射表是一種資料結構,用於存放索引值對。如果提供了鍵,就能尋找到值。Map介面的方法:Modifier and TypeMethod and Descriptionvoidclear()Removes all of the mappings from this map (optional operation).booleancontainsKey(Object key)Returns true if this map contains a mapping for the specified
InfoQ發布了一個關於規則引擎的介紹Real-World Rule Engines,原文 http://www.infoq.com/articles/Rule-Engines ONJava上也有兩篇文章:Give Your Business Logic a Framework with Drools http://www.onjava.com/lpt/a/6093Using Drools in Your Enterprise Java Application