if(rootList == null){
rootList = new ArrayList<Integer>();
cluster.put("root", rootList);
}
Tag curTag = null;
List<Integer> bmIdSeen = new ArrayList<Integer>();
List<Integer> curBmList = null;
for(BookmarkTag bt : bookmarkTags){
if(curTag == null || curTag.getId() != bt.getTag().getId()){
curTag = bt.getTag();
curBmList = new ArrayList<Integer>();
cluster.put(String.valueOf(curTag.getId()),curBmList);
tags.add(curTag);
}
int bmId = bt.getBookmark().getId();
curBmList.add(bmId);
if(bmIdSeen.contains(bmId) == false){