Issue #7613 Override Configurations.add(Configuration) (#7631)

Signed-off-by: Jan Bartel <janb@webtide.com>
This commit is contained in:
Jan Bartel 2022-02-22 10:51:46 +01:00 committed by GitHub
parent 808b74ff34
commit 3d9f34696b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 4 deletions

View File

@ -265,6 +265,12 @@ public class Configurations extends AbstractList<Configuration> implements Dumpa
.map(c -> c.getClass().getName())
.toArray(String[]::new));
}
@Override
public boolean add(Configuration configuration)
{
return addConfiguration(configuration);
}
public void add(Configuration... configurations)
{
@ -428,7 +434,7 @@ public class Configurations extends AbstractList<Configuration> implements Dumpa
return getConfigurations().iterator();
}
private void addConfiguration(Configuration configuration)
private boolean addConfiguration(Configuration configuration)
{
String name = configuration.getClass().getName();
// Is this configuration known?
@ -462,14 +468,14 @@ public class Configurations extends AbstractList<Configuration> implements Dumpa
if (r != null)
{
if (r.getName().equals(configuration.getClass().getName()))
return; //skip the addition, a replacement is already present
return false; //skip the addition, a replacement is already present
}
if (c.getClass().getName().equals(configuration.getClass().getName()))
return; //don't add same one twice
return false; //don't add same one twice
}
_configurations.add(configuration);
return _configurations.add(configuration);
}
@Override