公司面试题,请大家看哈兹,应该怎么做,说个思路也行
Java   Test 
 -   Write   a   program   that   can   parse   a   Windows   .ini   format   file   and   store   the   contents   in   memory   (in   some   datatype/class   of   your   choice) 
 -   Also   provide   some   convenience   api   that   allows   a   developer   to   retrieve   information   from   the   parsed   representation    
 e.g.   getIniKeys() 
                getIniVals() 
                getIniVal(String   aKey,   aGroupName) 
                getGroup(String   aGroupName    
 -   Provide   an   interactive   way   to   query   different   attributes,   e.g,   myname,   main.theIP,   Complex_Context.myname   
 Sample   Ini   File    
 =============== 
 myname   =   props   
 [main] 
 theIP   =   192.184.12.1 
 DNS   =   34.2.4.5 
 DNS   =   15.19.27.84   
 #   defines   a   group 
 [myhome] 
 IP   =   192.184.12.2 
 IP   =   192.168.12.50   
 [complex   context] 
 MyName   =   hallo   
 Some   Rules   To   keep   in   Mind 
 ========================== 
 a.   Ini   File   consists   of   a   set   of   attribute   value   pairs      that   are   grouped   into   sections/groups    
 b.   Groups   are   enclosed   within    "[] " 
 c.   Strip   off   any   whitespaces   encountered   between   keys   or   values    
 d.   comments   begin   with    "# " 
 e.   there   could   be   blank   lines   in   the   file    
 f.   there   could   be   white   space   in   the   group   name   (which   should   be   preserved)    
 g.   A   key   could   have   multiple   values   (e.g.   IP   in   the   above   sample   has   two   possible   values)   which   should   be   preserved        
 What   are   we   testing    
 ==================== 
 -   The   programmer 's   ability   to   write   good   clean,   readable   code   that   solves   the   above   problem.    
 -   We   are   NOT   looking   for   efficiency,   speed,   algorithmic   abilities   in   solving   this   problem    
------解决方案--------------------Map看起来不错,呵呵
------解决方案--------------------傻傻的一个办法 @_@   
 import java.io.BufferedReader; 
 import java.io.FileReader; 
 import 
java.io.IOException; 
 import java.util.ArrayList; 
 import java.util.HashMap; 
 import java.util.List; 
 import java.util.Map;   
 public class Test2 {  	 
   public static void main(String[] args) {       
     INI ini = new INI( "test.ini ");       
     List <String>  keys = ini.getIniKeys(); 
     ini.print(keys); 
     System.out.println();       
     List <String>  values = ini.getIniValues();