常用JAVA数据结构

一、基础数据类型:四类八种基本数据类型。

1、  整型:byte,short,int,long。

2、  浮点型:float,double。

3、  逻辑型:true,false。

4、  字符型:char

 

二、集合数据类型

1、  数组:有顺序,同样类型的数据,有长度。

2、  List:有顺序,不同类型的数据,没有长度。

3、  Set:无顺序,不同类型数据,没有长度。

4、  Map:键值对数据。HashMap,HashTable等

 

三、对象数据类型

1、  String对象,Date对象

2、自定义对象

 

一些例子:

后台:

List<HashMap> kobe = new ArrayList();  //声明一个List结构,里面存放HashMap类型数据。

HashMap qq = new HashMap();      //声明一个HashMap对象

qq.put(“Key”,”1”);        //设置Key为1

qq.put(“Value”,”男”);      //设置Value为男

kobe.add(qq);            //往List结构插入HashMap对象

request.setAtrribute(“kobe”,kobe);    //往前台设置kobe,前者是前台显示的。

 

前台:

<s:select name="xgRoomtype.xslb" list="#request.kobe" listKey="Key" listValue="Value"  cssStyle="width:70px"></s:select>

上述name是传入后台使用的,xgRoomtype是实体类的对象。Action中使用。

posted on 2012-06-09 14:12  专注2018  阅读(1555)  评论(0编辑  收藏  举报