@ Override public List < IScan > getScansByRtClosest ( double rt ) { List < IScan > result = null ; Map . Entry < Double , List < IScan > > lower = getMapRt2scan ( ) . lowerEntry ( rt ) ; Map . Entry < Double , List < IScan > > upper = getMapRt2scan ( ) . ceilingEntry ( rt ) ; if ( upper != null && lower != null ) { if ( Math . abs ( rt - lower . getKey ( ) ) <= Math . abs ( rt - upper . getKey ( ) ) ) { result = lower . getValue ( ) ; } else { result = upper . getValue ( ) ; } // result = Double.compare(lower.getKey(), upper.getKey()) > 0 ? lower.getValue() : upper.getValue(); } else if ( upper != null ) { result = upper . getValue ( ) ; } else if ( lower != null ) { result = lower . getValue ( ) ; } return result ; }
Scans with the closest RT are returned .