equal
deleted
inserted
replaced
1066 * around matches of this pattern |
1066 * around matches of this pattern |
1067 */ |
1067 */ |
1068 public String[] split(CharSequence input, int limit) { |
1068 public String[] split(CharSequence input, int limit) { |
1069 int index = 0; |
1069 int index = 0; |
1070 boolean matchLimited = limit > 0; |
1070 boolean matchLimited = limit > 0; |
1071 ArrayList<String> matchList = new ArrayList<String>(); |
1071 ArrayList<String> matchList = new ArrayList<>(); |
1072 Matcher m = matcher(input); |
1072 Matcher m = matcher(input); |
1073 |
1073 |
1074 // Add segments before each match found |
1074 // Add segments before each match found |
1075 while(m.find()) { |
1075 while(m.find()) { |
1076 if (!matchLimited || matchList.size() < limit - 1) { |
1076 if (!matchLimited || matchList.size() < limit - 1) { |
1564 compiled = true; |
1564 compiled = true; |
1565 } |
1565 } |
1566 |
1566 |
1567 Map<String, Integer> namedGroups() { |
1567 Map<String, Integer> namedGroups() { |
1568 if (namedGroups == null) |
1568 if (namedGroups == null) |
1569 namedGroups = new HashMap<String, Integer>(2); |
1569 namedGroups = new HashMap<>(2); |
1570 return namedGroups; |
1570 return namedGroups; |
1571 } |
1571 } |
1572 |
1572 |
1573 /** |
1573 /** |
1574 * Used to print out a subtree of the Pattern to help with debugging. |
1574 * Used to print out a subtree of the Pattern to help with debugging. |
5307 map.put(name, new CharPropertyFactory() { |
5307 map.put(name, new CharPropertyFactory() { |
5308 CharProperty make() { return p.clone();}}); |
5308 CharProperty make() { return p.clone();}}); |
5309 } |
5309 } |
5310 |
5310 |
5311 private static final HashMap<String, CharPropertyFactory> map |
5311 private static final HashMap<String, CharPropertyFactory> map |
5312 = new HashMap<String, CharPropertyFactory>(); |
5312 = new HashMap<>(); |
5313 |
5313 |
5314 static { |
5314 static { |
5315 // Unicode character property aliases, defined in |
5315 // Unicode character property aliases, defined in |
5316 // http://www.unicode.org/Public/UNIDATA/PropertyValueAliases.txt |
5316 // http://www.unicode.org/Public/UNIDATA/PropertyValueAliases.txt |
5317 defCategory("Cn", 1<<Character.UNASSIGNED); |
5317 defCategory("Cn", 1<<Character.UNASSIGNED); |