@@ -91,23 +91,23 @@ public class U<T> extends Underscore<T> {
9191 private static final int BUFFER_LENGTH_1024 = 1024 ;
9292 private static final int RESPONSE_CODE_400 = 400 ;
9393 private static final String ROOT = "root" ;
94- private static String upper = "[A-Z\\ xc0-\\ xd6\\ xd8-\\ xde\\ u0400-\\ u04FF]" ;
95- private static String lower = "[a-z\\ xdf-\\ xf6\\ xf8-\\ xff]+" ;
96- private static String selfClosing = "-self-closing" ;
97- private static String nilKey = "-nil" ;
98- private static java .util .regex .Pattern reWords =
94+ private static final String UPPER = "[A-Z\\ xc0-\\ xd6\\ xd8-\\ xde\\ u0400-\\ u04FF]" ;
95+ private static final String LOWER = "[a-z\\ xdf-\\ xf6\\ xf8-\\ xff]+" ;
96+ private static final String SELF_CLOSING = "-self-closing" ;
97+ private static final String NIL_KEY = "-nil" ;
98+ private static final java .util .regex .Pattern RE_WORDS =
9999 java .util .regex .Pattern .compile (
100- upper
100+ UPPER
101101 + "+(?="
102- + upper
103- + lower
102+ + UPPER
103+ + LOWER
104104 + ")|"
105- + upper
105+ + UPPER
106106 + "?"
107- + lower
107+ + LOWER
108108 + "|"
109- + upper
110- + "+|[0-9] +" );
109+ + UPPER
110+ + "+|\\ d +" );
111111
112112 static {
113113 String [] deburredLetters =
@@ -1460,7 +1460,7 @@ public static String deburr(final String string) {
14601460 public static List <String > words (final String string ) {
14611461 final String localString = baseToString (string );
14621462 final List <String > result = new ArrayList <>();
1463- final java .util .regex .Matcher matcher = reWords .matcher (localString );
1463+ final java .util .regex .Matcher matcher = RE_WORDS .matcher (localString );
14641464 while (matcher .find ()) {
14651465 result .add (matcher .group ());
14661466 }
@@ -2885,7 +2885,7 @@ public static Map<String, Object> removeMinusesAndConvertNumbers(Map<String, Obj
28852885 } else {
28862886 newKey = entry .getKey ();
28872887 }
2888- if (!entry .getKey ().equals (selfClosing )
2888+ if (!entry .getKey ().equals (SELF_CLOSING )
28892889 && !entry .getKey ().equals ("#omit-xml-declaration" )) {
28902890 outMap .put (newKey , makeObject (entry .getValue ()));
28912891 }
@@ -2963,7 +2963,7 @@ public static Map<String, Object> replaceSelfClosingWithEmpty(Map<String, Object
29632963 public static Object replaceSelfClosingWithValue (Map <String , Object > map , String value ) {
29642964 Object outMap = new LinkedHashMap <>();
29652965 for (Map .Entry <String , Object > entry : map .entrySet ()) {
2966- if (selfClosing .equals (entry .getKey ()) && "true" .equals (entry .getValue ())) {
2966+ if (SELF_CLOSING .equals (entry .getKey ()) && "true" .equals (entry .getValue ())) {
29672967 if (map .size () == 1 ) {
29682968 outMap = value ;
29692969 break ;
@@ -3226,9 +3226,9 @@ public static Map<String, Object> replaceFirstLevel(Map<String, Object> map, int
32263226 }
32273227 if (level == 0 && Xml .XmlValue .getMapValue (outMap ) instanceof Map ) {
32283228 Map <String , Object > outMap2 = (Map <String , Object >) Xml .XmlValue .getMapValue (outMap );
3229- if (selfClosing .equals (Xml .XmlValue .getMapKey (outMap2 ))
3229+ if (SELF_CLOSING .equals (Xml .XmlValue .getMapKey (outMap2 ))
32303230 && "true" .equals (Xml .XmlValue .getMapValue (outMap2 ))) {
3231- outMap2 .remove (selfClosing );
3231+ outMap2 .remove (SELF_CLOSING );
32323232 }
32333233 return outMap2 ;
32343234 }
@@ -3257,11 +3257,11 @@ public static Map<String, Object> replaceNilWithNull(Map<String, Object> map) {
32573257 for (Map .Entry <String , Object > entry : map .entrySet ()) {
32583258 Object outValue = makeReplaceNilWithNull (entry .getValue ());
32593259 if (outValue instanceof Map
3260- && (nilKey .equals (Xml .XmlValue .getMapKey (outValue ))
3260+ && (NIL_KEY .equals (Xml .XmlValue .getMapKey (outValue ))
32613261 || Xml .XmlValue .getMapKey (outValue ).endsWith (":nil" ))
32623262 && "true" .equals (Xml .XmlValue .getMapValue (outValue ))
3263- && ((Map ) outValue ).containsKey (selfClosing )
3264- && "true" .equals (((Map ) outValue ).get (selfClosing ))) {
3263+ && ((Map ) outValue ).containsKey (SELF_CLOSING )
3264+ && "true" .equals (((Map ) outValue ).get (SELF_CLOSING ))) {
32653265 outValue = null ;
32663266 }
32673267 outMap .put (entry .getKey (), outValue );
@@ -3405,7 +3405,7 @@ public Builder addNull(final String key) {
34053405
34063406 @ SuppressWarnings ("unchecked" )
34073407 public Map <String , Object > build () {
3408- return (Map <String , Object >) ((LinkedHashMap ) data ).clone ();
3408+ return (Map <String , Object >) ((LinkedHashMap <?, ?> ) data ).clone ();
34093409 }
34103410
34113411 public String toXml () {
@@ -3511,13 +3511,13 @@ public ArrayBuilder add(final Builder builder) {
35113511
35123512 @ SuppressWarnings ("unchecked" )
35133513 public ArrayBuilder merge (final List <Object > list ) {
3514- U .merge (data , (List <Object >) ((ArrayList ) list ).clone ());
3514+ U .merge (data , (List <Object >) ((ArrayList <?> ) list ).clone ());
35153515 return this ;
35163516 }
35173517
35183518 @ SuppressWarnings ("unchecked" )
35193519 public List <Object > build () {
3520- return (List <Object >) ((ArrayList ) data ).clone ();
3520+ return (List <Object >) ((ArrayList <?> ) data ).clone ();
35213521 }
35223522
35233523 public String toXml () {
0 commit comments