public Segment segment(long index){
  assertOpen();
  if (currentSegment != null && currentSegment.validIndex(index))   return currentSegment;
  Map.Entry<Long,Segment> segment=segments.floorEntry(index);
  return segment != null ? segment.getValue() : null;
}

public Segment segment ( long index ) { assertOpen ( ) ; if ( currentSegment != null && currentSegment . validIndex ( index ) ) return currentSegment ; Map . Entry < Long , Segment > segment = segments . floorEntry ( index ) ; return segment != null ? segment . getValue ( ) : null ; }
returns the segment for the given index .
