Simplify if conditions.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 18 Mar 2014 05:45:30 +0000 (06:45 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Tue, 18 Mar 2014 05:45:40 +0000 (06:45 +0100)
src/main/java/net/pterodactylus/rhynodge/filters/BlacklistFilter.java
src/main/java/net/pterodactylus/rhynodge/loader/Chain.java

index 676d7be..a519934 100644 (file)
@@ -56,7 +56,7 @@ public class BlacklistFilter implements Filter {
                return new TorrentState(from(torrentState.torrentFiles()).filter(new Predicate<TorrentFile>() {
                        @Override
                        public boolean apply(TorrentFile torrentFile) {
-                               return (torrentFile == null) ? false : nameDoesNotMatchAFilterWord(torrentFile.name());
+                               return (torrentFile != null) && nameDoesNotMatchAFilterWord(torrentFile.name());
                        }
 
                        private boolean nameDoesNotMatchAFilterWord(final String name) {
index d54fae0..ab81754 100644 (file)
@@ -85,10 +85,7 @@ public class Chain {
                        if (!name.equals(parameter.name)) {
                                return false;
                        }
-                       if (!value.equals(parameter.value)) {
-                               return false;
-                       }
-                       return true;
+                       return value.equals(parameter.value);
                }
 
        }
@@ -328,10 +325,7 @@ public class Chain {
                if (!action.equals(chain.action)) {
                        return false;
                }
-               if (updateInterval != chain.updateInterval) {
-                       return false;
-               }
-               return true;
+               return updateInterval == chain.updateInterval;
        }
 
 }