Merge pull request #391 from DevFactory/release/Useless-parentheses-around-expressions-should-be-removed-to-prevent-any-misunderstanding-fix-1

squid:UselessParenthesesCheck - Useless parentheses around expression…
This commit is contained in:
Narendra Pathai 2016-02-29 17:53:13 +05:30
commit 35d6a54831
10 changed files with 13 additions and 13 deletions

View File

@ -71,6 +71,6 @@ public final class Dispatcher {
} }
private void dispatchAction(Action action) { private void dispatchAction(Action action) {
stores.stream().forEach((store) -> store.onAction(action)); stores.stream().forEach(store -> store.onAction(action));
} }
} }

View File

@ -44,6 +44,6 @@ public abstract class Store {
} }
protected void notifyChange() { protected void notifyChange() {
views.stream().forEach((view) -> view.storeChanged(this)); views.stream().forEach(view -> view.storeChanged(this));
} }
} }

View File

@ -143,6 +143,6 @@ public class App {
} catch (InterruptedException e) { } catch (InterruptedException e) {
System.out.println(e); System.out.println(e);
} }
return (i) * (i + 1) / 2; return i * (i + 1) / 2;
} }
} }

View File

@ -54,7 +54,7 @@ public class CakeBakingServiceImpl implements CakeBakingService {
public void bakeNewCake(CakeInfo cakeInfo) throws CakeBakingException { public void bakeNewCake(CakeInfo cakeInfo) throws CakeBakingException {
List<CakeTopping> allToppings = getAvailableToppingEntities(); List<CakeTopping> allToppings = getAvailableToppingEntities();
List<CakeTopping> matchingToppings = List<CakeTopping> matchingToppings =
allToppings.stream().filter((t) -> t.getName().equals(cakeInfo.cakeToppingInfo.name)) allToppings.stream().filter(t -> t.getName().equals(cakeInfo.cakeToppingInfo.name))
.collect(Collectors.toList()); .collect(Collectors.toList());
if (matchingToppings.isEmpty()) { if (matchingToppings.isEmpty()) {
throw new CakeBakingException(String.format("Topping %s is not available", throw new CakeBakingException(String.format("Topping %s is not available",
@ -64,7 +64,7 @@ public class CakeBakingServiceImpl implements CakeBakingService {
Set<CakeLayer> foundLayers = new HashSet<>(); Set<CakeLayer> foundLayers = new HashSet<>();
for (CakeLayerInfo info : cakeInfo.cakeLayerInfos) { for (CakeLayerInfo info : cakeInfo.cakeLayerInfos) {
Optional<CakeLayer> found = Optional<CakeLayer> found =
allLayers.stream().filter((layer) -> layer.getName().equals(info.name)).findFirst(); allLayers.stream().filter(layer -> layer.getName().equals(info.name)).findFirst();
if (!found.isPresent()) { if (!found.isPresent()) {
throw new CakeBakingException(String.format("Layer %s is not available", info.name)); throw new CakeBakingException(String.format("Layer %s is not available", info.name));
} else { } else {

View File

@ -36,6 +36,6 @@ public class CakeViewImpl implements View {
} }
public void render() { public void render() {
cakeBakingService.getAllCakes().stream().forEach((cake) -> System.out.println(cake)); cakeBakingService.getAllCakes().stream().forEach(cake -> System.out.println(cake));
} }
} }

View File

@ -66,7 +66,7 @@ public class App {
}); });
context.start(); context.start();
context.getRoutes().stream().forEach((r) -> System.out.println(r)); context.getRoutes().stream().forEach(r -> System.out.println(r));
context.stop(); context.stop();
} }
} }

View File

@ -61,7 +61,7 @@ public class App {
}); });
ProducerTemplate template = context.createProducerTemplate(); ProducerTemplate template = context.createProducerTemplate();
context.start(); context.start();
context.getRoutes().stream().forEach((r) -> System.out.println(r)); context.getRoutes().stream().forEach(r -> System.out.println(r));
template.sendBody("direct:origin", "Hello from origin"); template.sendBody("direct:origin", "Hello from origin");
context.stop(); context.stop();
} }

View File

@ -47,7 +47,7 @@ public class LoggingHandler implements ChannelHandler {
* received is a ByteBuffer (from TCP channel) or a DatagramPacket (from UDP channel). * received is a ByteBuffer (from TCP channel) or a DatagramPacket (from UDP channel).
*/ */
if (readObject instanceof ByteBuffer) { if (readObject instanceof ByteBuffer) {
doLogging(((ByteBuffer) readObject)); doLogging((ByteBuffer) readObject);
sendReply(channel, key); sendReply(channel, key);
} else if (readObject instanceof DatagramPacket) { } else if (readObject instanceof DatagramPacket) {
DatagramPacket datagram = (DatagramPacket) readObject; DatagramPacket datagram = (DatagramPacket) readObject;

View File

@ -97,9 +97,9 @@ public class Person {
final int prime = 31; final int prime = 31;
int result = 1; int result = 1;
result = prime * result + age; result = prime * result + age;
result = prime * result + ((id == null) ? 0 : id.hashCode()); result = prime * result + (id == null ? 0 : id.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode()); result = prime * result + (name == null ? 0 : name.hashCode());
result = prime * result + ((surname == null) ? 0 : surname.hashCode()); result = prime * result + (surname == null ? 0 : surname.hashCode());
return result; return result;
} }

View File

@ -97,7 +97,7 @@ public class Character {
.append(name) .append(name)
.append(" armed with a ") .append(" armed with a ")
.append(weapon != null ? weapon : spell != null ? spell : "with nothing") .append(weapon != null ? weapon : spell != null ? spell : "with nothing")
.append(abilities != null ? (" and wielding " + abilities + " abilities") : "") .append(abilities != null ? " and wielding " + abilities + " abilities" : "")
.append('.'); .append('.');
return sb.toString(); return sb.toString();
} }