You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by jo...@apache.org on 2020/11/07 21:32:29 UTC

[commons-vfs] branch master updated: Simplify some equals statement by use Objects.equals

This is an automated email from the ASF dual-hosted git repository.

jochen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-vfs.git


The following commit(s) were added to refs/heads/master by this push:
     new 3b37042  Simplify some equals statement by use Objects.equals
     new cf1e5c6  Merge pull request #146 from PeterAlfredLee/simplify-equals
3b37042 is described below

commit 3b370429d821232e9c180f0baf6c5e3e90d34eb3
Author: PeterAlfredLee <pe...@gmail.com>
AuthorDate: Sat Nov 7 15:24:11 2020 +0800

    Simplify some equals statement by use Objects.equals
---
 .../java/org/apache/commons/vfs2/UserAuthenticationData.java  | 11 ++---------
 .../vfs2/provider/sftp/SftpFileSystemConfigBuilder.java       | 10 ++--------
 2 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticationData.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticationData.java
index 1d37a0e..fe07ffa 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticationData.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/UserAuthenticationData.java
@@ -16,8 +16,8 @@
  */
 package org.apache.commons.vfs2;
 
-import java.util.Iterator;
 import java.util.Map;
+import java.util.Objects;
 import java.util.TreeMap;
 
 /**
@@ -49,14 +49,7 @@ public class UserAuthenticationData {
             if (o == null || getClass() != o.getClass()) {
                 return false;
             }
-
-            final Type type1 = (Type) o;
-
-            if (type != null ? !type.equals(type1.type) : type1.type != null) {
-                return false;
-            }
-
-            return true;
+            return Objects.equals(type, ((Type) o).type);
         }
 
         @Override
diff --git a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilder.java b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilder.java
index a55082e..afdde3f 100644
--- a/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilder.java
+++ b/commons-vfs2/src/main/java/org/apache/commons/vfs2/provider/sftp/SftpFileSystemConfigBuilder.java
@@ -19,6 +19,7 @@ package org.apache.commons.vfs2.provider.sftp;
 import java.io.File;
 import java.io.Serializable;
 import java.util.Arrays;
+import java.util.Objects;
 
 import org.apache.commons.vfs2.FileSystem;
 import org.apache.commons.vfs2.FileSystemConfigBuilder;
@@ -61,14 +62,7 @@ public final class SftpFileSystemConfigBuilder extends FileSystemConfigBuilder {
             if (obj == null || this.getClass() != obj.getClass()) {
                 return false;
             }
-
-            final ProxyType pType = (ProxyType) obj;
-
-            if (this.proxyType != null ? !this.proxyType.equals(pType.proxyType) : pType.proxyType != null) {
-                return false;
-            }
-
-            return true;
+            return Objects.equals(this.proxyType, ((ProxyType) obj).proxyType);
         }
 
         /**