diff --git a/javaguide.html b/javaguide.html index 3ce36e5..5ef0dc8 100644 --- a/javaguide.html +++ b/javaguide.html @@ -186,37 +186,21 @@ statements.
Import statements are divided into the following groups, in this order, with each group -separated by a single blank line:
+Imports are ordered as follows:
com.google
imports
- (only if this source file is in the com.google
package
- space)android
, com
, org
, sun
java
importsjavax
importsWithin a group there are no blank lines, and the imported names appear in ASCII sort -order. (Note: this is not the same as the import statements being in -ASCII sort order; the presence of semicolons warps the result.)
+If there are both static and non-static imports, a single blank line separates the two +blocks. There are no other blank lines between import statements.
+ +Within each block the imported names appear in ASCII sort order. (Note: +this is not the same as the import statements being in ASCII sort order, since '.' +sorts before ';'.)
+ +else
or a comma.
-Example:
+Examples:
-return new MyClass() { +return () -> { + while (condition()) { + method(); + } +}; + +return new MyClass() { @Override public void method() { if (condition()) { try { @@ -381,7 +371,8 @@ without the need to line-wrap. such as C++ and JavaScript.)
.
), the ampersand in type bounds
+ (.
), the two colons of a method reference
+ (::
), the ampersand in type bounds
(<T extends Foo & Bar>
), and the pipe in
catch blocks
(catch (FooException | BarException e)
).:
) in an enhanced
for
("foreach") statement(String str) -> str.length()
::
) of a method reference, which
+ is written like Object::toString
.
), which is written like
+ object.toString()
@Partial @Mock DataLoader loader;-
There are no specific rules for formatting parameter and local variable annotations.
+There are no specific rules for formatting annotations on parameters, local variables, or types. +
public protected private abstract static final transient volatile synchronized native strictfp +public protected private abstract default static final transient volatile synchronized native strictfp4.8.8 Numeric Literals