Skip to content

Commit

Permalink
[MNG-6847] Use diamond operator
Browse files Browse the repository at this point in the history
  • Loading branch information
2 people authored and elharo committed Oct 3, 2023
1 parent 3d9e7f0 commit 172d7d6
Show file tree
Hide file tree
Showing 20 changed files with 29 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public final class SessionEventSupport
/**
* registered listeners
*/
private final List<SessionListener> listeners = new ArrayList<SessionListener>();
private final List<SessionListener> listeners = new ArrayList<>();

/**
* Adds the listener to the collection of listeners
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public final class TransferEventSupport
/**
* registered listeners
*/
private final List<TransferListener> listeners = new ArrayList<TransferListener>();
private final List<TransferListener> listeners = new ArrayList<>();

/**
* Adds the listener to the collection of listeners
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,7 @@ public void testWagonPutDirectoryWhenDirectoryAlreadyExists()

wagon.putDirectory( sourceFile, dirName );

List<String> resourceNames = new ArrayList<String>( resources.length + 1 );
List<String> resourceNames = new ArrayList<>( resources.length + 1 );

resourceNames.add( dirName + "/" + resourceToCreate );
for ( String resource : resources )
Expand Down Expand Up @@ -591,7 +591,7 @@ public void testWagonPutDirectoryForDot()

wagon.putDirectory( sourceFile, "." );

List<String> resourceNames = new ArrayList<String>( resources.length + 1 );
List<String> resourceNames = new ArrayList<>( resources.length + 1 );

resourceNames.add( resourceToCreate );
Collections.addAll( resourceNames, resources );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1172,7 +1172,7 @@ public static class RedirectHandler

File repositoryDirectory;

public List<HandlerRequestResponse> handlerRequestResponses = new ArrayList<HandlerRequestResponse>();
public List<HandlerRequestResponse> handlerRequestResponses = new ArrayList<>();

RedirectHandler( String reason, int retCode, String redirectUrl, File repositoryDirectory )
{
Expand Down Expand Up @@ -2079,11 +2079,11 @@ public static class PutHandler
{
private final File resourceBase;

public List<DeployedResource> deployedResources = new ArrayList<DeployedResource>();
public List<DeployedResource> deployedResources = new ArrayList<>();

public int putCallNumber = 0;

public List<HandlerRequestResponse> handlerRequestResponses = new ArrayList<HandlerRequestResponse>();
public List<HandlerRequestResponse> handlerRequestResponses = new ArrayList<>();

public PutHandler( File repositoryDirectory )
{
Expand Down Expand Up @@ -2140,7 +2140,7 @@ private static class AuthorizingProxyHandler
extends TestHeaderHandler
{

List<HandlerRequestResponse> handlerRequestResponses = new ArrayList<HandlerRequestResponse>();
List<HandlerRequestResponse> handlerRequestResponses = new ArrayList<>();

public void handle( String target, Request baseRequest, HttpServletRequest request,
HttpServletResponse response ) throws IOException, ServletException
Expand Down Expand Up @@ -2173,7 +2173,7 @@ private static class TestHeaderHandler
{
public Map<String, String> headers = Collections.emptyMap();

public List<HandlerRequestResponse> handlerRequestResponses = new ArrayList<HandlerRequestResponse>();
public List<HandlerRequestResponse> handlerRequestResponses = new ArrayList<>();

TestHeaderHandler()
{
Expand All @@ -2182,7 +2182,7 @@ private static class TestHeaderHandler
public void handle( String target, Request baseRrequest, HttpServletRequest request,
HttpServletResponse response ) throws IOException, ServletException
{
headers = new HashMap<String, String>();
headers = new HashMap<>();
for ( Enumeration<String> e = baseRrequest.getHeaderNames(); e.hasMoreElements(); )
{
String name = e.nextElement();
Expand Down Expand Up @@ -2243,7 +2243,7 @@ public static class TestSecurityHandler
extends ConstraintSecurityHandler
{

public List<HandlerRequestResponse> handlerRequestResponses = new ArrayList<HandlerRequestResponse>();
public List<HandlerRequestResponse> handlerRequestResponses = new ArrayList<>();

@Override
public void handle( String target, Request baseRequest, HttpServletRequest request,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public List<String> getFileList( String destinationDirectory )

File[] files = path.listFiles();

List<String> list = new ArrayList<String>( files.length );
List<String> list = new ArrayList<>( files.length );
for ( File file : files )
{
String name = file.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ public List<String> getFileList( String destinationDirectory )
throw new ResourceDoesNotExistException( "Could not find file: '" + resource + "'" );
}

List<String> ret = new ArrayList<String>();
List<String> ret = new ArrayList<>();
for ( FTPFile file : ftpFiles )
{
String name = file.getName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ protected void setupWagonTestingFixtures()
user.setName("admin");
user.setPassword("admin");

List<Authority> authorities = new ArrayList<Authority>();
List<Authority> authorities = new ArrayList<>();
authorities.add( new WritePermission() );

user.setAuthorities( authorities );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
public class LightweightHttpWagonAuthenticator
extends Authenticator
{
ThreadLocal<LightweightHttpWagon> localWagon = new ThreadLocal<LightweightHttpWagon>();
ThreadLocal<LightweightHttpWagon> localWagon = new ThreadLocal<>();

protected PasswordAuthentication getPasswordAuthentication()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ private String ensureDirs( ScmProvider scmProvider, ScmRepository scmRepository,
String res =
partCOSubdir.length() >= targetName.length() ? "" : targetName.substring( partCOSubdir.length() ) + '/';

ArrayList<File> createdDirs = new ArrayList<File>();
ArrayList<File> createdDirs = new ArrayList<>();
File deepDir = new File( checkoutDirectory, res );

boolean added = false;
Expand Down Expand Up @@ -842,7 +842,7 @@ public List<String> getFileList( String resourcePath )
throw new ResourceDoesNotExistException( result.getProviderMessage() );
}

List<String> files = new ArrayList<String>();
List<String> files = new ArrayList<>();

for ( ScmFile f : result.getFiles() )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ private String[] splitCommandString( String command )
}

String[] args = command.split( " " );
List<String> parts = new ArrayList<String>();
List<String> parts = new ArrayList<>();
parts.add( args[0] );
for ( int i = 1; i < args.length; i++ )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public class SshServerEmbedded

private SshServer sshd;

private List<String> sshKeysResources = new ArrayList<String>();
private List<String> sshKeysResources = new ArrayList<>();

private TestPublickeyAuthenticator publickeyAuthenticator;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class TestPasswordAuthenticator
implements PasswordAuthenticator
{
List<PasswordAuthenticatorRequest> requests =
new ArrayList<PasswordAuthenticatorRequest>();
new ArrayList<>();

public boolean authenticate( String username, String password, ServerSession session )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class TestPublickeyAuthenticator
implements PublickeyAuthenticator
{
private List<PublickeyAuthenticatorRequest> publickeyAuthenticatorRequests =
new ArrayList<PublickeyAuthenticatorRequest>();
new ArrayList<>();

private boolean keyAuthz;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class LSParser
public List<String> parseFiles( String rawLS )
throws TransferFailedException
{
List<String> ret = new ArrayList<String>();
List<String> ret = new ArrayList<>();
try
{
BufferedReader br = new BufferedReader( new StringReader( rawLS ) );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public abstract class AbstractKnownHostsProvider
*/
protected String contents;

protected Set<KnownHostEntry> knownHosts = new HashSet<KnownHostEntry>();
protected Set<KnownHostEntry> knownHosts = new HashSet<>();

public void setHostKeyChecking( String hostKeyChecking )
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public StreamKnownHostsProvider( InputStream stream )
protected Set<KnownHostEntry> loadKnownHosts( String contents )
throws IOException
{
Set<KnownHostEntry> hosts = new HashSet<KnownHostEntry>();
Set<KnownHostEntry> hosts = new HashSet<>();

BufferedReader br = new BufferedReader( new StringReader( contents ) );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ public List<String> getFileList( String destinationDirectory )

@SuppressWarnings( "unchecked" )
List<ChannelSftp.LsEntry> fileList = channel.ls( filename );
List<String> files = new ArrayList<String>( fileList.size() );
List<String> files = new ArrayList<>( fileList.size() );
for ( ChannelSftp.LsEntry entry : fileList )
{
String name = entry.getFilename();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class MultiStatus
* Map collecting the responses for this multistatus, where every href must
* only occur one single time.
*/
private Map<String, MultiStatusResponse> responses = new LinkedHashMap<String, MultiStatusResponse>();
private Map<String, MultiStatusResponse> responses = new LinkedHashMap<>();

/**
* A general response description at the multistatus top level is used to
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ public abstract class HttpWagonTests

private String baseUrl;

private static final Set<File> TMP_FILES = new HashSet<File>();
private static final Set<File> TMP_FILES = new HashSet<>();

private Repository repo;

private final Set<Object> notificationTargets = new HashSet<Object>();
private final Set<Object> notificationTargets = new HashSet<>();

// CHECKSTYLE_OFF: ConstantName
protected static final Logger logger = LoggerFactory.getLogger( HttpWagonTests.class );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public final class TestUtil
private static final Logger logger = LoggerFactory.getLogger( TestUtil.class );
// CHECKSTYLE_ON: ConstantName

private static final Map<String, File> BASES = new HashMap<String, File>();
private static final Map<String, File> BASES = new HashMap<>();

private TestUtil()
{
Expand Down

0 comments on commit 172d7d6

Please sign in to comment.