From 734d50d0867687149785a9f5cc0d05bb3c4a29e2 Mon Sep 17 00:00:00 2001 From: thatsIch Date: Fri, 25 Sep 2015 23:18:27 +0200 Subject: [PATCH] prefer isEmpty over length() == 0 --- .../appeng/client/gui/implementations/GuiCraftAmount.java | 4 ++-- .../client/gui/implementations/GuiInterfaceTerminal.java | 2 +- .../appeng/client/gui/implementations/GuiLevelEmitter.java | 4 ++-- .../appeng/client/gui/implementations/GuiMEMonitorable.java | 2 +- .../java/appeng/client/gui/implementations/GuiPriority.java | 4 ++-- .../container/implementations/ContainerCraftConfirm.java | 2 +- .../container/implementations/ContainerCraftingStatus.java | 2 +- src/main/java/appeng/core/api/ApiPart.java | 2 +- .../appeng/core/features/registries/InscriberRegistry.java | 2 +- .../appeng/core/features/registries/WirelessRegistry.java | 2 +- src/main/java/appeng/recipes/GroupIngredient.java | 2 +- src/main/java/appeng/recipes/IngredientSet.java | 2 +- 12 files changed, 15 insertions(+), 15 deletions(-) diff --git a/src/main/java/appeng/client/gui/implementations/GuiCraftAmount.java b/src/main/java/appeng/client/gui/implementations/GuiCraftAmount.java index a2641cbc..ce26a4f4 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiCraftAmount.java +++ b/src/main/java/appeng/client/gui/implementations/GuiCraftAmount.java @@ -201,7 +201,7 @@ public class GuiCraftAmount extends AEBaseGui this.amountToCraft.setText( out ); } - if( out.length() == 0 ) + if( out.isEmpty() ) { out = "0"; } @@ -275,7 +275,7 @@ public class GuiCraftAmount extends AEBaseGui this.amountToCraft.setText( out ); } - if( out.length() == 0 ) + if( out.isEmpty() ) { out = "0"; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java b/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java index 980ba21e..259a409b 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java +++ b/src/main/java/appeng/client/gui/implementations/GuiInterfaceTerminal.java @@ -189,7 +189,7 @@ public class GuiInterfaceTerminal extends AEBaseGui { if( !this.checkHotbarKeys( key ) ) { - if( character == ' ' && this.searchField.getText().length() == 0 ) + if( character == ' ' && this.searchField.getText().isEmpty() ) { return; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiLevelEmitter.java b/src/main/java/appeng/client/gui/implementations/GuiLevelEmitter.java index 62a2c490..5f2a5ff5 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiLevelEmitter.java +++ b/src/main/java/appeng/client/gui/implementations/GuiLevelEmitter.java @@ -210,7 +210,7 @@ public class GuiLevelEmitter extends GuiUpgradeable this.level.setText( Out ); } - if( Out.length() == 0 ) + if( Out.isEmpty() ) { Out = "0"; } @@ -260,7 +260,7 @@ public class GuiLevelEmitter extends GuiUpgradeable this.level.setText( Out ); } - if( Out.length() == 0 ) + if( Out.isEmpty() ) { Out = "0"; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java b/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java index a747d738..6381c41e 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java +++ b/src/main/java/appeng/client/gui/implementations/GuiMEMonitorable.java @@ -461,7 +461,7 @@ public class GuiMEMonitorable extends AEBaseMEGui implements ISortSource, IConfi { if( !this.checkHotbarKeys( key ) ) { - if( character == ' ' && this.searchField.getText().length() == 0 ) + if( character == ' ' && this.searchField.getText().isEmpty() ) { return; } diff --git a/src/main/java/appeng/client/gui/implementations/GuiPriority.java b/src/main/java/appeng/client/gui/implementations/GuiPriority.java index 62dddb1c..1fd632e4 100644 --- a/src/main/java/appeng/client/gui/implementations/GuiPriority.java +++ b/src/main/java/appeng/client/gui/implementations/GuiPriority.java @@ -221,7 +221,7 @@ public class GuiPriority extends AEBaseGui this.priority.setText( out ); } - if( out.length() == 0 ) + if( out.isEmpty() ) { out = "0"; } @@ -267,7 +267,7 @@ public class GuiPriority extends AEBaseGui this.priority.setText( out ); } - if( out.length() == 0 ) + if( out.isEmpty() ) { out = "0"; } diff --git a/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java b/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java index a1f31d8d..b995f8e5 100644 --- a/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java +++ b/src/main/java/appeng/container/implementations/ContainerCraftConfirm.java @@ -180,7 +180,7 @@ public class ContainerCraftConfirm extends AEBaseContainer this.sendCPUs(); } - this.noCPU = this.cpus.size() == 0; + this.noCPU = this.cpus.isEmpty(); super.detectAndSendChanges(); diff --git a/src/main/java/appeng/container/implementations/ContainerCraftingStatus.java b/src/main/java/appeng/container/implementations/ContainerCraftingStatus.java index 4f382ee7..8e56a71a 100644 --- a/src/main/java/appeng/container/implementations/ContainerCraftingStatus.java +++ b/src/main/java/appeng/container/implementations/ContainerCraftingStatus.java @@ -94,7 +94,7 @@ public class ContainerCraftingStatus extends ContainerCraftingCPU this.sendCPUs(); } - this.noCPU = this.cpus.size() == 0; + this.noCPU = this.cpus.isEmpty(); super.detectAndSendChanges(); } diff --git a/src/main/java/appeng/core/api/ApiPart.java b/src/main/java/appeng/core/api/ApiPart.java index 82bec292..24a6db2c 100644 --- a/src/main/java/appeng/core/api/ApiPart.java +++ b/src/main/java/appeng/core/api/ApiPart.java @@ -82,7 +82,7 @@ public class ApiPart implements IPartHelper public Class getCombinedInstance( String base ) { - if( this.desc.size() == 0 ) + if( this.desc.isEmpty() ) { try { diff --git a/src/main/java/appeng/core/features/registries/InscriberRegistry.java b/src/main/java/appeng/core/features/registries/InscriberRegistry.java index e7a38407..3e43741f 100644 --- a/src/main/java/appeng/core/features/registries/InscriberRegistry.java +++ b/src/main/java/appeng/core/features/registries/InscriberRegistry.java @@ -179,7 +179,7 @@ public final class InscriberRegistry implements IInscriberRegistry { throw new IllegalStateException( "Input must be defined." ); } - if( this.inputs.size() == 0 ) + if( this.inputs.isEmpty() ) { throw new IllegalStateException( "Input must have a size." ); } diff --git a/src/main/java/appeng/core/features/registries/WirelessRegistry.java b/src/main/java/appeng/core/features/registries/WirelessRegistry.java index bba934a2..328b9fe4 100644 --- a/src/main/java/appeng/core/features/registries/WirelessRegistry.java +++ b/src/main/java/appeng/core/features/registries/WirelessRegistry.java @@ -95,7 +95,7 @@ public final class WirelessRegistry implements IWirelessTermRegistry final IWirelessTermHandler handler = this.getWirelessTerminalHandler( item ); final String unparsedKey = handler.getEncryptionKey( item ); - if( unparsedKey.length() == 0 ) + if( unparsedKey.isEmpty() ) { player.addChatMessage( PlayerMessages.DeviceNotLinked.get() ); return; diff --git a/src/main/java/appeng/recipes/GroupIngredient.java b/src/main/java/appeng/recipes/GroupIngredient.java index c1c053a4..0a3eb415 100644 --- a/src/main/java/appeng/recipes/GroupIngredient.java +++ b/src/main/java/appeng/recipes/GroupIngredient.java @@ -111,7 +111,7 @@ public class GroupIngredient implements IIngredient this.isInside = false; } - if( out.size() == 0 ) + if( out.isEmpty() ) { throw new MissingIngredientError( this.toString() + " - group could not be resolved to any items." ); } diff --git a/src/main/java/appeng/recipes/IngredientSet.java b/src/main/java/appeng/recipes/IngredientSet.java index 43afdcf6..7835adc9 100644 --- a/src/main/java/appeng/recipes/IngredientSet.java +++ b/src/main/java/appeng/recipes/IngredientSet.java @@ -76,7 +76,7 @@ public class IngredientSet implements IIngredient List out = new LinkedList(); out.addAll( this.items ); - if( out.size() == 0 ) + if( out.isEmpty() ) { throw new MissingIngredientError( this.toString() + " - group could not be resolved to any items." ); }