diff options
author | Javen O'Neal <onealj@apache.org> | 2017-10-18 07:33:07 +0000 |
---|---|---|
committer | Javen O'Neal <onealj@apache.org> | 2017-10-18 07:33:07 +0000 |
commit | f786b16f7f55caa6c9aa7cf65cc0400b584397ae (patch) | |
tree | 425d21b5ef12d3ea8bbc13ff07a58473e3e032fd /src | |
parent | 63b3a4e491b8a3efe1ffb373570dc34b645d8e4e (diff) | |
download | poi-f786b16f7f55caa6c9aa7cf65cc0400b584397ae.tar.gz poi-f786b16f7f55caa6c9aa7cf65cc0400b584397ae.zip |
for -> foreach
string.equals() -> string.isEmpty() or .equals(string)
ArrayList -> List
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1812461 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src')
-rw-r--r-- | src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java b/src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java index 90dc298b45..4d2fe75466 100644 --- a/src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java +++ b/src/scratchpad/src/org/apache/poi/hdgf/extractor/VisioTextExtractor.java @@ -21,6 +21,7 @@ import java.io.FileInputStream; import java.io.IOException; import java.io.InputStream; import java.util.ArrayList; +import java.util.List; import org.apache.poi.POIOLE2TextExtractor; import org.apache.poi.hdgf.HDGFDiagram; @@ -65,26 +66,25 @@ public final class VisioTextExtractor extends POIOLE2TextExtractor { * @return An array of each Text item in the document */ public String[] getAllText() { - ArrayList<String> text = new ArrayList<>(); + List<String> text = new ArrayList<>(); for(Stream stream : hdgf.getTopLevelStreams()) { findText(stream, text); } return text.toArray( new String[text.size()] ); } - private void findText(Stream stream, ArrayList<String> text) { + private void findText(Stream stream, List<String> text) { if(stream instanceof PointerContainingStream) { PointerContainingStream ps = (PointerContainingStream)stream; - for(int i=0; i<ps.getPointedToStreams().length; i++) { - findText(ps.getPointedToStreams()[i], text); + for(final Stream substream : ps.getPointedToStreams()) { + findText(substream, text); } } if(stream instanceof ChunkStream) { ChunkStream cs = (ChunkStream)stream; - for(int i=0; i<cs.getChunks().length; i++) { - Chunk chunk = cs.getChunks()[i]; + for(final Chunk chunk : cs.getChunks()) { if(chunk != null && chunk.getName() != null && - chunk.getName().equals("Text") && + "Text".equals(chunk.getName()) && chunk.getCommands().length > 0) { // First command @@ -93,7 +93,7 @@ public final class VisioTextExtractor extends POIOLE2TextExtractor { // Capture the text, as long as it isn't // simply an empty string String str = cmd.getValue().toString(); - if(str.equals("") || str.equals("\n")) { + if(str.isEmpty() || "\n".equals(str)) { // Ignore empty strings } else { text.add( str ); |