There is a rule " 4.5.2 indentation lines with at least +4 spaces " in the Google Java Style Guide, which states:
In general, two continuation lines use the same level of indentation if and only if they start with syntactically parallel elements.
Can someone explain what “ syntactically parallel elements ” mean and provide some examples for this case?
Google Style Style, , , , . () , .
1 ( ):
foo("bar" + "baz" + "boo");
2 ( ):
foo("bar" + foo2("bar" + "baz"));
2 foo2() foo(), foo2() , foo(), : " ".
foo2()
foo()
Google Java , + "baz")); 4 .
+ "baz"));
, , " " ; , , - .
, , , . .
String[] elements = new String[] { "bob", "joe", "pete" };
( ), String .
String
{ System.out.println("hi"); actNow(input); for (int i = 0; i < j; i++) { return 5; } }
System.out.println("hi");, actNow(input);, for , . , return 5; , for. , return 5; - .
System.out.println("hi");
actNow(input);
return 5;