diff options
| author | Michael Williamson <mike@zwobble.org> | 2016-01-03 14:42:50 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2016-01-03 14:42:50 +0000 |
| commit | 4f8c4b581f16551a364e203fd8142f7717101a2f (patch) | |
| tree | 077bb2fd98d675a039478980b90ffe77616de42f /src/main/java/org/zwobble/mammoth/docx | |
| parent | 6e97bf5bb28ad5a63f396873399a457be6fe779d (diff) | |
Add list as shorter alias of ImmutableList.of
Diffstat (limited to 'src/main/java/org/zwobble/mammoth/docx')
| -rw-r--r-- | src/main/java/org/zwobble/mammoth/docx/BodyXmlReader.java | 15 | ||||
| -rw-r--r-- | src/main/java/org/zwobble/mammoth/docx/OfficeXml.java | 5 |
2 files changed, 10 insertions, 10 deletions
diff --git a/src/main/java/org/zwobble/mammoth/docx/BodyXmlReader.java b/src/main/java/org/zwobble/mammoth/docx/BodyXmlReader.java index a61e4dd..33fc5b0 100644 --- a/src/main/java/org/zwobble/mammoth/docx/BodyXmlReader.java +++ b/src/main/java/org/zwobble/mammoth/docx/BodyXmlReader.java @@ -9,9 +9,8 @@ import org.zwobble.mammoth.xml.XmlNode; import java.util.List; import java.util.Optional; -import static com.google.common.collect.Iterables.concat; -import static com.google.common.collect.Iterables.filter; -import static com.google.common.collect.Iterables.transform; +import static com.google.common.collect.Iterables.*; +import static org.zwobble.mammoth.util.MammothLists.list; public class BodyXmlReader { private final Styles styles; @@ -23,18 +22,18 @@ public class BodyXmlReader { public List<DocumentElement> readElement(XmlElement element) { switch (element.getName()) { case "w:t": - return ImmutableList.of(new Text(element.innerText())); + return list(new Text(element.innerText())); case "w:r": - return ImmutableList.of(new Run(readElements(element.children()))); + return list(new Run(readElements(element.children()))); case "w:p": - return ImmutableList.of(readParagraph(element)); + return list(readParagraph(element)); case "w:pPr": - return ImmutableList.of(); + return list(); default: // TODO: emit warning - return ImmutableList.of(); + return list(); } } diff --git a/src/main/java/org/zwobble/mammoth/docx/OfficeXml.java b/src/main/java/org/zwobble/mammoth/docx/OfficeXml.java index a1d156f..43d86ad 100644 --- a/src/main/java/org/zwobble/mammoth/docx/OfficeXml.java +++ b/src/main/java/org/zwobble/mammoth/docx/OfficeXml.java @@ -13,6 +13,7 @@ import java.util.List; import static com.google.common.collect.Iterables.concat; import static com.google.common.collect.Iterables.transform; +import static org.zwobble.mammoth.util.MammothLists.list; public class OfficeXml { private static ImmutableBiMap<String, String> XML_NAMESPACES = ImmutableBiMap.<String, String>builder() @@ -44,13 +45,13 @@ public class OfficeXml { element.getName(), element.getAttributes(), ImmutableList.copyOf(concat(transform(element.children(), OfficeXml::collapseAlternateContent)))); - return ImmutableList.of(collapsedElement); + return list(collapsedElement); } } @Override public List<XmlNode> visit(XmlTextNode textNode) { - return ImmutableList.of(textNode); + return list(textNode); } }); } |
