@@ -54,18 +54,19 @@ private void writeString(final String text) throws IOException {
5454 out .write (text .getBytes (charset ));
5555 }
5656
57- /*
58- * Recursive method to extract text from all nodes
59- * - This method processes TextNode and <br> tags, recursively
60- * extracting text from nested tags.
61- * For example: extract text from nested <span> tags
62- * - Appends newlines for <br> tags.
57+ /**
58+ * <p>Recursive method to extract text from all nodes.</p>
59+ * <p>
60+ * This method processes {@link TextNode}s and {@code <br>} tags,
61+ * recursively extracting text from nested tags
62+ * (e.g. extracting text from nested {@code <span>} tags).
63+ * Newlines are added for {@code <br>} tags.
64+ * </p>
6365 */
6466 private void extractText (final Node node , final StringBuilder text ) {
65- if (node instanceof TextNode ) {
66- text .append (((TextNode ) node ).text ());
67- } else if (node instanceof Element ) {
68- final Element element = (Element ) node ;
67+ if (node instanceof TextNode textNode ) {
68+ text .append ((textNode ).text ());
69+ } else if (node instanceof Element element ) {
6970 // <br> is a self-closing HTML tag used to insert a line break.
7071 if (element .tagName ().equalsIgnoreCase ("br" )) {
7172 // Add a newline for <br> tags
@@ -98,7 +99,7 @@ public void build(final SharpStream ttml) throws IOException {
9899 final Elements paragraphList = doc .select ("body > div > p" );
99100
100101 // check if has frames
101- if (paragraphList .size () < 1 ) {
102+ if (paragraphList .isEmpty () ) {
102103 return ;
103104 }
104105
0 commit comments