测试1
package com.biz.test.newpage;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
public class testk {
public static List<String> list;
public static Set<String> set;
public static void main(String[] args) {
list=getData();
set = getDataSet();
Iterator<String> it = set.iterator();
Map<String,List<String>> map = new LinkedHashMap<String,List<String>>();
while(it.hasNext())
{
String setName = it.next();
List<String> dataList = new ArrayList<String>();
for (String string : list) {
String[]str = string.split("\\$\\$\\$");
if(str[0].contains(setName)){
//System.out.println(str[1]);
//System.out.println(setName);
dataList.add(str[1]);
}
}
map.put(setName, dataList);
for (String v : dataList) {
System.out.println("key:"+setName+"\t value:"+v);
}
}
}
public static List<String> getData(){
List<String> list = new ArrayList<String>();
list.add("###20110810$$$hello3434334343443hhh20110810");
list.add("###20110810$$$world3434334343443hhh20110810");
list.add("###20110811$$$hello3434334343443hhh20110811");
list.add("###20110811$$$world3434334343443hhh20110811");
list.add("###20110812$$$hello3434334343443hhh20110812");
list.add("###20110812$$$world3434334343443hhh20110812");
list.add("###20110813$$$hello3434334343443hhh20110813");
list.add("###20110813$$$world3434334343443hhh20110813");
list.add("###20110814$$$hello3434334343443hhh20110814");
list.add("###20110814$$$world3434334343443hhh20110814");
list.add("###20110815$$$hello3434334343443hhh20110815");
list.add("###20110815$$$world3434334343443hhh20110815");
return list;
}
public static Set<String> getDataSet(){
Set<String> set = new LinkedHashSet<String>();
set.add("20110810");
set.add("20110811");
set.add("20110812");
set.add("20110813");
set.add("20110814");
set.add("20110815");
return set;
}
}