5959import java .util .Arrays ;
6060import java .util .List ;
6161import java .util .Map ;
62- import java .util .TreeMap ;
6362import java .util .function .Function ;
6463import java .util .stream .Collectors ;
6564import java .util .stream .IntStream ;
@@ -71,7 +70,6 @@ public static String composeClassHeaderMethodSampleCode(
7170 TypeNode clientType ,
7271 Map <String , ResourceName > resourceNames ,
7372 Map <String , Message > messageTypes ) {
74- resourceNames = sortAlphabetically (resourceNames );
7573 // Use the first pure unary RPC method's sample code as showcase, if no such method exists, use
7674 // the first method in the service's methods list.
7775 Method method =
@@ -234,7 +232,6 @@ public static String composeRpcMethodHeaderSampleCode(
234232 List <MethodArgument > arguments ,
235233 Map <String , ResourceName > resourceNames ,
236234 Map <String , Message > messageTypes ) {
237- resourceNames = sortAlphabetically (resourceNames );
238235 VariableExpr clientVarExpr =
239236 VariableExpr .withVariable (
240237 Variable .builder ()
@@ -281,7 +278,6 @@ public static String composeRpcDefaultMethodHeaderSampleCode(
281278 TypeNode clientType ,
282279 Map <String , ResourceName > resourceNames ,
283280 Map <String , Message > messageTypes ) {
284- resourceNames = sortAlphabetically (resourceNames );
285281 VariableExpr clientVarExpr =
286282 VariableExpr .withVariable (
287283 Variable .builder ()
@@ -340,7 +336,6 @@ public static String composeLroCallableMethodHeaderSampleCode(
340336 TypeNode clientType ,
341337 Map <String , ResourceName > resourceNames ,
342338 Map <String , Message > messageTypes ) {
343- resourceNames = sortAlphabetically (resourceNames );
344339 VariableExpr clientVarExpr =
345340 VariableExpr .withVariable (
346341 Variable .builder ()
@@ -453,7 +448,6 @@ public static String composePagedCallableMethodHeaderSampleCode(
453448 TypeNode clientType ,
454449 Map <String , ResourceName > resourceNames ,
455450 Map <String , Message > messageTypes ) {
456- resourceNames = sortAlphabetically (resourceNames );
457451 VariableExpr clientVarExpr =
458452 VariableExpr .withVariable (
459453 Variable .builder ()
@@ -573,7 +567,6 @@ public static String composeRegularCallableMethodHeaderSampleCode(
573567 TypeNode clientType ,
574568 Map <String , ResourceName > resourceNames ,
575569 Map <String , Message > messageTypes ) {
576- resourceNames = sortAlphabetically (resourceNames );
577570 VariableExpr clientVarExpr =
578571 VariableExpr .withVariable (
579572 Variable .builder ()
@@ -623,7 +616,6 @@ public static String composeStreamCallableMethodHeaderSampleCode(
623616 TypeNode clientType ,
624617 Map <String , ResourceName > resourceNames ,
625618 Map <String , Message > messageTypes ) {
626- resourceNames = sortAlphabetically (resourceNames );
627619 VariableExpr clientVarExpr =
628620 VariableExpr .withVariable (
629621 Variable .builder ()
@@ -847,7 +839,7 @@ private static List<Statement> composeStreamServerBodyStatements(
847839 List <Statement > bodyStatements =
848840 bodyExprs .stream ().map (e -> ExprStatement .withExpr (e )).collect (Collectors .toList ());
849841
850- // For-loop on server stream variable expresion .
842+ // For-loop on server stream variable expression .
851843 // e.g. for (EchoResponse response : stream) {
852844 // // Do something when a response is received.
853845 // }
@@ -1357,16 +1349,4 @@ private static boolean isProtoEmptyType(TypeNode type) {
13571349 return type .reference ().pakkage ().equals ("com.google.protobuf" )
13581350 && type .reference ().name ().equals ("Empty" );
13591351 }
1360-
1361- /**
1362- * Returns the same "resource type name" to "resource name" key-value map as given, but sorted in
1363- * alphabetical order. This prevents resource name flip-flopping between executions on the various
1364- * machines used for client library publication.
1365- */
1366- private static TreeMap <String , ResourceName > sortAlphabetically (
1367- Map <String , ResourceName > unsorted ) {
1368- // This simple wrapper is not redundant because it hides implementation details from the
1369- // callers.
1370- return new TreeMap <>(unsorted );
1371- }
13721352}
0 commit comments