Checking String for emptiness with .lenght() is preferable since 1.6

This commit is contained in:
vraskulin 2017-02-28 11:46:51 +03:00
parent ad7d3c8078
commit 04973ea5aa
4 changed files with 5 additions and 5 deletions

View file

@ -636,7 +636,7 @@ public class TablesPanel extends javax.swing.JPanel {
List<RowFilter<Object, Object>> ignoreListFilterList = new ArrayList<>(); List<RowFilter<Object, Object>> ignoreListFilterList = new ArrayList<>();
String serverAddress = SessionHandler.getSession().getServerHostname().orElseGet(() -> ""); String serverAddress = SessionHandler.getSession().getServerHostname().orElseGet(() -> "");
final Set<String> ignoreListCopy = IgnoreList.ignoreList(serverAddress); final Set<String> ignoreListCopy = IgnoreList.ignoreList(serverAddress);
if (ignoreListCopy.size() > 0) { if (!ignoreListCopy.isEmpty()) {
ignoreListFilterList.add(new RowFilter<Object, Object>() { ignoreListFilterList.add(new RowFilter<Object, Object>() {
@Override @Override
public boolean include(Entry<? extends Object, ? extends Object> entry) { public boolean include(Entry<? extends Object, ? extends Object> entry) {

View file

@ -36,7 +36,7 @@ public final class IgnoreList {
} }
public static String ignore(String serverAddress, String user) { public static String ignore(String serverAddress, String user) {
if (user == null || user.length() == 0) { if (user == null || user.isEmpty()) {
return ignoreListString(serverAddress); return ignoreListString(serverAddress);
} }
@ -71,7 +71,7 @@ public final class IgnoreList {
} }
public static String unignore(String serverAddress, String user) { public static String unignore(String serverAddress, String user) {
if (user == null || user.length() == 0) { if (user == null || user.isEmpty()) {
return usage(); return usage();
} }
if (MagePreferences.removeIgnoredUser(serverAddress, user)) { if (MagePreferences.removeIgnoredUser(serverAddress, user)) {

View file

@ -143,7 +143,7 @@ public class ArrowBuilder {
if (map.containsKey(gameId)) { if (map.containsKey(gameId)) {
Map<Type, List<Arrow>> innerMap = map.get(gameId); Map<Type, List<Arrow>> innerMap = map.get(gameId);
java.util.List<Arrow> arrows = innerMap.get(type); java.util.List<Arrow> arrows = innerMap.get(type);
if (arrows != null && arrows.size() > 0) { if (arrows != null && !arrows.isEmpty()) {
JPanel p = getArrowsPanel(gameId); JPanel p = getArrowsPanel(gameId);
synchronized (map) { synchronized (map) {
for (Arrow arrow : arrows) { for (Arrow arrow : arrows) {

View file

@ -67,7 +67,7 @@ public class CanadianHighlander extends Constructed {
valid = false; valid = false;
} }
if (deck.getSideboard().size() > 0) { if (!deck.getSideboard().isEmpty()) {
invalid.put("Deck", "Sideboard can't contain any cards: has " + (deck.getSideboard().size()) + " cards"); invalid.put("Deck", "Sideboard can't contain any cards: has " + (deck.getSideboard().size()) + " cards");
valid = false; valid = false;
} }