Remove unnecessary unmodifiable collection wrappers.

This commit is contained in:
akwizgran
2016-11-16 16:19:47 +00:00
parent 68abf8ba1a
commit f4c26d9cc7
16 changed files with 68 additions and 56 deletions

View File

@@ -42,6 +42,7 @@ class ConnectionRegistryImpl implements ConnectionRegistry {
contactCounts = new HashMap<ContactId, Integer>();
}
@Override
public void registerConnection(ContactId c, TransportId t,
boolean incoming) {
if (LOG.isLoggable(INFO)) {
@@ -76,6 +77,7 @@ class ConnectionRegistryImpl implements ConnectionRegistry {
}
}
@Override
public void unregisterConnection(ContactId c, TransportId t,
boolean incoming) {
if (LOG.isLoggable(INFO)) {
@@ -112,6 +114,7 @@ class ConnectionRegistryImpl implements ConnectionRegistry {
}
}
@Override
public Collection<ContactId> getConnectedContacts(TransportId t) {
lock.lock();
try {
@@ -120,12 +123,13 @@ class ConnectionRegistryImpl implements ConnectionRegistry {
List<ContactId> ids = new ArrayList<ContactId>(m.keySet());
if (LOG.isLoggable(INFO))
LOG.info(ids.size() + " contacts connected");
return Collections.unmodifiableList(ids);
return ids;
} finally {
lock.unlock();
}
}
@Override
public boolean isConnected(ContactId c, TransportId t) {
lock.lock();
try {
@@ -136,6 +140,7 @@ class ConnectionRegistryImpl implements ConnectionRegistry {
}
}
@Override
public boolean isConnected(ContactId c) {
lock.lock();
try {

View File

@@ -156,12 +156,12 @@ class PluginManagerImpl implements PluginManager, Service {
@Override
public Collection<SimplexPlugin> getSimplexPlugins() {
return Collections.unmodifiableList(simplexPlugins);
return new ArrayList<SimplexPlugin>(simplexPlugins);
}
@Override
public Collection<DuplexPlugin> getDuplexPlugins() {
return Collections.unmodifiableList(duplexPlugins);
return new ArrayList<DuplexPlugin>(duplexPlugins);
}
@Override
@@ -169,7 +169,7 @@ class PluginManagerImpl implements PluginManager, Service {
List<DuplexPlugin> supported = new ArrayList<DuplexPlugin>();
for (DuplexPlugin d : duplexPlugins)
if (d.supportsInvitations()) supported.add(d);
return Collections.unmodifiableList(supported);
return supported;
}
@Override
@@ -177,7 +177,7 @@ class PluginManagerImpl implements PluginManager, Service {
List<DuplexPlugin> supported = new ArrayList<DuplexPlugin>();
for (DuplexPlugin d : duplexPlugins)
if (d.supportsKeyAgreement()) supported.add(d);
return Collections.unmodifiableList(supported);
return supported;
}
private class PluginStarter implements Runnable {