diff --git a/src/java.base/share/classes/java/text/Collator.java b/src/java.base/share/classes/java/text/Collator.java index f011dbdccf3..f53fa14875d 100644 --- a/src/java.base/share/classes/java/text/Collator.java +++ b/src/java.base/share/classes/java/text/Collator.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2021, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -72,14 +72,15 @@ import sun.util.locale.provider.LocaleServiceProviderPool; * The following example shows how to compare two strings using * the {@code Collator} for the default locale. *
- *
{@code
+ * {@snippet lang=java :
  * // Compare two strings in the default locale
  * Collator myCollator = Collator.getInstance();
- * if( myCollator.compare("abc", "ABC") < 0 )
+ * if (myCollator.compare("abc", "ABC") < 0) {
  *     System.out.println("abc is less than ABC");
- * else
+ * } else {
  *     System.out.println("abc is greater than or equal to ABC");
- * }
+ * } + * } *
* *

@@ -94,14 +95,14 @@ import sun.util.locale.provider.LocaleServiceProviderPool; * The following shows how both case and accents could be ignored for * US English. *

- *
- * //Get the Collator for US English and set its strength to PRIMARY
+ * {@snippet lang=java :
+ * // Get the Collator for US English and set its strength to PRIMARY
  * Collator usCollator = Collator.getInstance(Locale.US);
  * usCollator.setStrength(Collator.PRIMARY);
- * if( usCollator.compare("abc", "ABC") == 0 ) {
+ * if (usCollator.compare("abc", "ABC") == 0) {
  *     System.out.println("Strings are equivalent");
  * }
- * 
+ * } *
*

* For comparing {@code String}s exactly once, the {@code compare}