private long collectAllKids ( ArrayList < DisplayInstance > result , ServerInstanceLogRecordList list ) { long timestamp = - 1 ; RepositoryLogRecord first = list . iterator ( ) . next ( ) ; if ( first != null ) { timestamp = first . getMillis ( ) ; } for ( Entry < String , ServerInstanceLogRecordList > kid : list . getChildren ( ) . entrySet ( ) ) { ArrayList < DisplayInstance > kidResult = new ArrayList < DisplayInstance > ( ) ; long curTimestamp = collectAllKids ( kidResult , kid . getValue ( ) ) ; // Add this kid only if there's a record among its descendants if ( curTimestamp > 0 ) { result . add ( new DisplayInstance ( kid . getKey ( ) , Long . toString ( list . getStartTime ( ) . getTime ( ) ) , curTimestamp , kidResult ) ) ; if ( timestamp < curTimestamp ) { timestamp = curTimestamp ; } } } return timestamp ; }
collects all descendant instances into an array and calculates largest timestamp of their first records .