public Iterable<Span> extractSpans(final CharSequence input) {
        if (input == null) {
            throw new NullPointerException("input must not be null");
        }
        return new Iterable<Span>() {
            @Override
            public Iterator<Span> iterator() {
                return new SpanIterator(input, new LinkIterator(input));
            }
        };
    }
public Iterable < Span > extractSpans ( final CharSequence input ) { if ( input == null ) { throw new NullPointerException ( "input must not be null" ) ; } return new Iterable < Span > ( ) { @ Override public Iterator < Span > iterator ( ) { return new SpanIterator ( input , new LinkIterator ( input ) ) ; } } ; }
Extract spans from the input text. A span is a substring of the input and represents either a link
(see {@link LinkSpan}) or plain text outside a link.
<p>
Using this is more convenient than {@link #extractLinks} if you want to transform the whole input text to
a different format.

@param input the input text, must not be null
@return a lazy iterable for the spans in order that they appear in the input, never null