question: MarkerSegment findMarkerSegment ( Class cls , boolean first ) { if ( first ) { Iterator iter = markerSequence . iterator ( ) ; while ( iter . hasNext ( ) ) { MarkerSegment seg = ( MarkerSegment ) iter . next ( ) ; if ( cls . isInstance ( seg ) ) { return seg ; } } } else { ListIterator iter = markerSequence . listIterator ( markerSequence . size ( ) ) ; while ( iter . hasPrevious ( ) ) { MarkerSegment seg = ( MarkerSegment ) iter . previous ( ) ; if ( cls . isInstance ( seg ) ) { return seg ; } } } return null ; }
target:  Returns the first or last MarkerSegment object in the list of the given class, or null if none is found.