private String reorderedImportsString(ImmutableSortedSet<Import> imports) {
assert !imports.isEmpty();
Import firstImport = imports.iterator().next();
// Pretend that the first import was preceded by another import of the same kind
// (static or non-static), so we don't insert a newline there.
boolean lastWasStatic = firstImport.isStatic;
StringBuilder sb = new StringBuilder();
for (Import thisImport : imports) {
if (lastWasStatic && !thisImport.isStatic) {
// Blank line between static and non-static imports.
sb.append(lineSeparator);
}
lastWasStatic = thisImport.isStatic;
sb.append(thisImport);
}
return sb.toString();
}
ImportOrderer.java 文件源码
java
阅读 33
收藏 0
点赞 0
评论 0
项目:javaide
作者:
评论列表
文章目录