< prev index next >

make/jdk/src/classes/build/tools/generatecharacter/PropList.java

Print this page
rev 56092 : imported patch 8229831

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2011, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2019, 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
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -29,11 +29,12 @@
 import java.util.*;
 import java.io.*;
 
 /**
  * A PropList object contains the lists of code points that have
- * the same Unicode property defined in PropList.txt
+ * the same Unicode property defined in PropList.txt and
+ * DerivedCoreProperties.txt
  *
  * @author Xueming Shen
  */
 public class PropList {
 

@@ -49,12 +50,17 @@
 
     public Set<String> names() {
         return propMap.keySet();
     }
 
-    private Map<String, ArrayList<Integer>> propMap =
-        new LinkedHashMap<String, ArrayList<Integer>>();
+    public void putAll(PropList pl) {
+        pl.names().stream()
+            .forEach(name -> propMap.put(name, pl.codepoints(name)));
+    }
+
+    private Map<String, List<Integer>> propMap =
+        new LinkedHashMap<String, List<Integer>>();
 
     private PropList(File file, int plane) throws IOException {
 
         int i, j;
         BufferedReader sbfr = new BufferedReader(new FileReader(file));

@@ -76,11 +82,11 @@
                 String name = m.group(3);
 
                 start &= 0xffff;
                 end &= 0xffff;
 
-                ArrayList<Integer> list = propMap.get(name);
+                List<Integer> list = propMap.get(name);
                 if (list == null) {
                     list = new ArrayList<Integer>();
                     propMap.put(name, list);
                 }
                 while (start <= end)
< prev index next >