@Test public void testLineIterator() { LineIterator lineIter; lineIter = new WordWrapLineIterator("this is a string", 10); Assert.assertEquals("this is a", lineIter.next()); Assert.assertEquals("string", lineIter.next()); lineIter = new WordWrapLineIterator("this is a string", 4); Assert.assertEquals("this", lineIter.next()); Assert.assertEquals("is a", lineIter.next()); Assert.assertEquals("stri", lineIter.next()); Assert.assertEquals("ng", lineIter.next()); lineIter = new WordWrapLineIterator("this\nis\na\nstring\n", 4); Assert.assertEquals("this", lineIter.next()); Assert.assertEquals("is", lineIter.next()); Assert.assertEquals("a", lineIter.next()); Assert.assertEquals("stri", lineIter.next()); Assert.assertEquals("ng", lineIter.next()); lineIter = new WordWrapLineIterator("this is a string", 15); Assert.assertEquals("this is a", lineIter.next()); Assert.assertEquals("string", lineIter.next()); }
public LineIterator (String str) { this.str = str; this.strLength = str.length();; while (strLength > 0 && Character.isWhitespace(str.charAt(strLength - 1))) { --strLength; } }
LineIterator implements Iterator<String> { public LineIterator (String str) { this.str = str; this.strLength = str.length();; while (strLength > 0 && Character.isWhitespace(str.charAt(strLength - 1))) { --strLength; } } }
LineIterator implements Iterator<String> { public LineIterator (String str) { this.str = str; this.strLength = str.length();; while (strLength > 0 && Character.isWhitespace(str.charAt(strLength - 1))) { --strLength; } } LineIterator(String str); }
LineIterator implements Iterator<String> { public LineIterator (String str) { this.str = str; this.strLength = str.length();; while (strLength > 0 && Character.isWhitespace(str.charAt(strLength - 1))) { --strLength; } } LineIterator(String str); void reset(String str); int getTabExpansion(); void setTabExpansion(int tabExpansion); }
LineIterator implements Iterator<String> { public LineIterator (String str) { this.str = str; this.strLength = str.length();; while (strLength > 0 && Character.isWhitespace(str.charAt(strLength - 1))) { --strLength; } } LineIterator(String str); void reset(String str); int getTabExpansion(); void setTabExpansion(int tabExpansion);  }