Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public List<String> getOrder() {
}

public void setOrder(List<String> statusOrder) {
if (statusOrder != null && statusOrder.size() > 0) {
if (statusOrder != null && !statusOrder.isEmpty()) {
this.order = statusOrder;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected Status aggregateStatus(List<Status> candidates) {
}
}
// If no status is given return UNKNOWN
if (filteredCandidates.size() == 0) {
if (filteredCandidates.isEmpty()) {
return Status.UNKNOWN;
}
// Sort given Status instances by configured order
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public AnyNestedCondition(ConfigurationPhase configurationPhase) {

@Override
protected ConditionOutcome getFinalMatchOutcome(MemberMatchOutcomes memberOutcomes) {
return new ConditionOutcome(memberOutcomes.getMatches().size() > 0,
return new ConditionOutcome(!memberOutcomes.getMatches().isEmpty(),
"nested any match resulted in " + memberOutcomes.getMatches()
+ " matches and " + memberOutcomes.getNonMatches()
+ " non matches");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public ConditionOutcome getMatchOutcome(ConditionContext context,
? this.defaultResourceLoader : context.getResourceLoader();
List<String> locations = new ArrayList<String>();
collectValues(locations, attributes.get("resources"));
Assert.isTrue(locations.size() > 0,
Assert.isTrue(!locations.isEmpty(),
"@ConditionalOnResource annotations must specify at least one resource location");
for (String location : locations) {
if (!loader
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public void logAutoConfigurationReport(boolean isCrashReport) {
this.report = ConditionEvaluationReport
.get(this.applicationContext.getBeanFactory());
}
if (this.report.getConditionAndOutcomesBySource().size() > 0) {
if (!this.report.getConditionAndOutcomesBySource().isEmpty()) {
if (isCrashReport && this.logger.isInfoEnabled()
&& !this.logger.isDebugEnabled()) {
this.logger.info("\n\nError starting ApplicationContext. "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public ExitStatus run(String... args) throws Exception {
if (index == 0) {
showCommandHints(starting);
}
else if ((arguments.size() > 0) && (starting.length() > 0)) {
else if (!arguments.isEmpty() && (starting.length() > 0)) {
String command = arguments.remove(0);
showCommandOptionHints(command, Collections.unmodifiableList(arguments),
starting);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ else if (isDetectType()) {
if (types.size() == 1) {
return types.values().iterator().next();
}
else if (types.size() == 0) {
else if (types.isEmpty()) {
throw new ReportableException("No type found with build '" + this.build
+ "' and format '" + this.format
+ "' check the service capabilities (--list)");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ private SourceOptions(List<?> nonOptionArguments, ClassLoader classLoader) {
}
this.args = Collections.unmodifiableList(
nonOptionArguments.subList(sourceArgCount, nonOptionArguments.size()));
Assert.isTrue(sources.size() > 0, "Please specify at least one file");
Assert.isTrue(!sources.isEmpty(), "Please specify at least one file");
this.sources = Collections.unmodifiableList(sources);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ private URL[] getGroovyJars(final ClassLoader parent) {
if (urls.isEmpty()) {
findGroovyJarsFromClassPath(parent, urls);
}
Assert.state(urls.size() > 0, "Unable to find groovy JAR");
Assert.state(!urls.isEmpty(), "Unable to find groovy JAR");
return new ArrayList<URL>(urls).toArray(new URL[urls.size()]);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class SnakeTimer {
private static final ConcurrentHashMap<Integer, Snake> snakes = new ConcurrentHashMap<Integer, Snake>();

public static synchronized void addSnake(Snake snake) {
if (snakes.size() == 0) {
if (snakes.isEmpty()) {
startTimer();
}
snakes.put(Integer.valueOf(snake.getId()), snake);
Expand All @@ -54,7 +54,7 @@ public static Collection<Snake> getSnakes() {

public static synchronized void removeSnake(Snake snake) {
snakes.remove(Integer.valueOf(snake.getId()));
if (snakes.size() == 0) {
if (snakes.isEmpty()) {
stopTimer();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class SnakeTimer {
private static final ConcurrentHashMap<Integer, Snake> snakes = new ConcurrentHashMap<Integer, Snake>();

public static synchronized void addSnake(Snake snake) {
if (snakes.size() == 0) {
if (snakes.isEmpty()) {
startTimer();
}
snakes.put(Integer.valueOf(snake.getId()), snake);
Expand All @@ -54,7 +54,7 @@ public static Collection<Snake> getSnakes() {

public static synchronized void removeSnake(Snake snake) {
snakes.remove(Integer.valueOf(snake.getId()));
if (snakes.size() == 0) {
if (snakes.isEmpty()) {
stopTimer();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public class SnakeTimer {
private static final ConcurrentHashMap<Integer, Snake> snakes = new ConcurrentHashMap<Integer, Snake>();

public static synchronized void addSnake(Snake snake) {
if (snakes.size() == 0) {
if (snakes.isEmpty()) {
startTimer();
}
snakes.put(Integer.valueOf(snake.getId()), snake);
Expand All @@ -54,7 +54,7 @@ public static Collection<Snake> getSnakes() {

public static synchronized void removeSnake(Snake snake) {
snakes.remove(Integer.valueOf(snake.getId()));
if (snakes.size() == 0) {
if (snakes.isEmpty()) {
stopTimer();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public void processResource(String resource, InputStream is,

@Override
public boolean hasTransformedResource() {
return this.data.size() > 0;
return !this.data.isEmpty();
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ private void maybeActivateProfiles(Set<String> profiles) {
}
return;
}
if (profiles.size() > 0) {
if (!profiles.isEmpty()) {
addProfiles(profiles);
this.logger.debug("Activated profiles "
+ StringUtils.collectionToCommaDelimitedString(profiles));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public class DelegatingApplicationContextInitializer implements
public void initialize(ConfigurableApplicationContext context) {
ConfigurableEnvironment environment = context.getEnvironment();
List<Class<?>> initializerClasses = getInitializerClasses(environment);
if (initializerClasses.size() > 0) {
if (!initializerClasses.isEmpty()) {
applyInitializerClasses(context, initializerClasses);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -261,13 +261,13 @@ protected void configure(FilterRegistration.Dynamic registration) {
DEFAULT_URL_MAPPINGS);
}
else {
if (servletNames.size() > 0) {
if (!servletNames.isEmpty()) {
this.logger.info("Mapping filter: '" + registration.getName()
+ "' to servlets: " + servletNames);
registration.addMappingForServletNames(dispatcherTypes, this.matchAfter,
servletNames.toArray(new String[servletNames.size()]));
}
if (this.urlPatterns.size() > 0) {
if (!this.urlPatterns.isEmpty()) {
this.logger.info("Mapping filter: '" + registration.getName()
+ "' to urls: " + this.urlPatterns);
registration.addMappingForUrlPatterns(dispatcherTypes, this.matchAfter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ protected void configure(Registration.Dynamic registration) {
"Registration is null. Was something already registered for name=["
+ this.name + "]?");
registration.setAsyncSupported(this.asyncSupported);
if (this.initParameters.size() > 0) {
if (!this.initParameters.isEmpty()) {
registration.setInitParameters(this.initParameters);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ protected WebApplicationContext createRootApplicationContext(
.findAnnotation(getClass(), Configuration.class) != null) {
application.getSources().add(getClass());
}
Assert.state(application.getSources().size() > 0,
Assert.state(!application.getSources().isEmpty(),
"No SpringApplication sources have been defined. Either override the "
+ "configure method or add an @Configuration annotation");
// Ensure error pages are registered
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ private Set<Object> getSources(MergedContextConfiguration mergedConfig) {
Set<Object> sources = new LinkedHashSet<Object>();
sources.addAll(Arrays.asList(mergedConfig.getClasses()));
sources.addAll(Arrays.asList(mergedConfig.getLocations()));
Assert.state(sources.size() > 0, "No configuration classes "
Assert.state(!sources.isEmpty(), "No configuration classes "
+ "or locations found in @SpringApplicationConfiguration. "
+ "For default configuration detection to work you need "
+ "Spring 4.0.3 or better (found " + SpringVersion.getVersion() + ").");
Expand Down