long start = 0L;
List<TraceEvent> l = new ArrayList<TraceEvent>();
for (int i = 0; i < data.size(); i++)
{
TraceEvent te = data.get(i);
l.add(te);
if (start == 0L)
start = te.getTimestamp();
if (isEndState(te))
{
result.put(Long.toString(start) + "-" + Long.toString(te.getTimestamp()), l);
start = 0L;
l = new ArrayList<TraceEvent>();
}
}