garydgregory commented on a change in pull request #120:
URL: https://github.com/apache/commons-io/pull/120#discussion_r438360990



##########
File path: src/main/java/org/apache/commons/io/Charsets.java
##########
@@ -71,16 +83,8 @@
      * @see Charset#availableCharsets()
      * @since 2.5
      */
-    public static SortedMap<String, Charset> requiredCharsets() {
-        // maybe cache?
-        final TreeMap<String, Charset> m = new 
TreeMap<>(String.CASE_INSENSITIVE_ORDER);
-        m.put(StandardCharsets.ISO_8859_1.name(), StandardCharsets.ISO_8859_1);
-        m.put(StandardCharsets.US_ASCII.name(), StandardCharsets.US_ASCII);
-        m.put(StandardCharsets.UTF_16.name(), StandardCharsets.UTF_16);
-        m.put(StandardCharsets.UTF_16BE.name(), StandardCharsets.UTF_16BE);
-        m.put(StandardCharsets.UTF_16LE.name(), StandardCharsets.UTF_16LE);
-        m.put(StandardCharsets.UTF_8.name(), StandardCharsets.UTF_8);
-        return Collections.unmodifiableSortedMap(m);
+    public static Map<String, Charset> requiredCharsets() {
+        return Collections.unmodifiableSortedMap(REQUIRED_CHARSETS);

Review comment:
       Is there a reason why `REQUIRED_CHARSETS` is modifiable but not the 
value returned by this method?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to