Use List.of() and Set.of() where feasible
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -47,7 +47,7 @@ import org.springframework.core.Ordered;
|
||||
* public CacheManager cacheManager() {
|
||||
* // configure and return an implementation of Spring's CacheManager SPI
|
||||
* SimpleCacheManager cacheManager = new SimpleCacheManager();
|
||||
* cacheManager.setCaches(Arrays.asList(new ConcurrentMapCache("default")));
|
||||
* cacheManager.setCaches(Set.of(new ConcurrentMapCache("default")));
|
||||
* return cacheManager;
|
||||
* }
|
||||
* }</pre>
|
||||
@@ -116,7 +116,7 @@ import org.springframework.core.Ordered;
|
||||
* public CacheManager cacheManager() {
|
||||
* // configure and return an implementation of Spring's CacheManager SPI
|
||||
* SimpleCacheManager cacheManager = new SimpleCacheManager();
|
||||
* cacheManager.setCaches(Arrays.asList(new ConcurrentMapCache("default")));
|
||||
* cacheManager.setCaches(Set.of(new ConcurrentMapCache("default")));
|
||||
* return cacheManager;
|
||||
* }
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -16,9 +16,8 @@
|
||||
|
||||
package org.springframework.cache.interceptor;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.lang.Nullable;
|
||||
@@ -41,7 +40,7 @@ public class NamedCacheResolver extends AbstractCacheResolver {
|
||||
|
||||
public NamedCacheResolver(CacheManager cacheManager, String... cacheNames) {
|
||||
super(cacheManager);
|
||||
this.cacheNames = new ArrayList<>(Arrays.asList(cacheNames));
|
||||
this.cacheNames = List.of(cacheNames);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2021 the original author or authors.
|
||||
* Copyright 2002-2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,7 +19,6 @@ package org.springframework.scheduling.annotation;
|
||||
import java.lang.reflect.Method;
|
||||
import java.time.Duration;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.IdentityHashMap;
|
||||
@@ -361,7 +360,7 @@ public class ScheduledAnnotationBeanPostProcessor
|
||||
|
||||
Class<?> targetClass = AopProxyUtils.ultimateTargetClass(bean);
|
||||
if (!this.nonAnnotatedClasses.contains(targetClass) &&
|
||||
AnnotationUtils.isCandidateClass(targetClass, Arrays.asList(Scheduled.class, Schedules.class))) {
|
||||
AnnotationUtils.isCandidateClass(targetClass, List.of(Scheduled.class, Schedules.class))) {
|
||||
Map<Method, Set<Scheduled>> annotatedMethods = MethodIntrospector.selectMethods(targetClass,
|
||||
(MethodIntrospector.MetadataLookup<Set<Scheduled>>) method -> {
|
||||
Set<Scheduled> scheduledAnnotations = AnnotatedElementUtils.getMergedRepeatableAnnotations(
|
||||
|
||||
Reference in New Issue
Block a user