commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From brit...@apache.org
Subject svn commit: r1716249 - /commons/proper/jxpath/trunk/src/main/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributeIterator.java
Date Tue, 24 Nov 2015 20:38:16 GMT
Author: britter
Date: Tue Nov 24 20:38:16 2015
New Revision: 1716249

URL: http://svn.apache.org/viewvc?rev=1716249&view=rev
Log:
Use Objects.equals instead of private util method with the same functionality

Modified:
    commons/proper/jxpath/trunk/src/main/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributeIterator.java

Modified: commons/proper/jxpath/trunk/src/main/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributeIterator.java
URL: http://svn.apache.org/viewvc/commons/proper/jxpath/trunk/src/main/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributeIterator.java?rev=1716249&r1=1716248&r2=1716249&view=diff
==============================================================================
--- commons/proper/jxpath/trunk/src/main/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributeIterator.java
(original)
+++ commons/proper/jxpath/trunk/src/main/java/org/apache/commons/jxpath/ri/model/dom/DOMAttributeIterator.java
Tue Nov 24 20:38:16 2015
@@ -18,6 +18,7 @@ package org.apache.commons.jxpath.ri.mod
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.Objects;
 
 import org.apache.commons.jxpath.ri.QName;
 import org.apache.commons.jxpath.ri.model.NodeIterator;
@@ -91,29 +92,19 @@ public class DOMAttributeIterator implem
         if (testLocalName.equals("*") || testLocalName.equals(nodeLocalName)) {
             String testPrefix = name.getPrefix();
 
-            if (testPrefix == null || equalStrings(testPrefix, nodePrefix)) {
+            if (testPrefix == null || Objects.equals(testPrefix, nodePrefix)) {
                 return true;
             }
             if (nodePrefix == null) {
                 return false;
             }
-            return equalStrings(parent.getNamespaceURI(testPrefix), parent
-                    .getNamespaceURI(nodePrefix));
+            return Objects.equals(parent.getNamespaceURI(testPrefix), parent
+                        .getNamespaceURI(nodePrefix));
         }
         return false;
     }
 
     /**
-     * Test whether two strings are == or .equals()
-     * @param s1 first string
-     * @param s2 second string
-     * @return boolean
-     */
-    private static boolean equalStrings(String s1, String s2) {
-        return s1 == s2 || s1 != null && s1.equals(s2);
-    }
-
-    /**
      * Get the named attribute.
      * @param element to search
      * @param name to match



Mime
View raw message