Router: more type arguments, for each

This commit is contained in:
str4d
2013-11-22 10:16:34 +00:00
parent 15bf94b479
commit e853d9a40b
7 changed files with 15 additions and 18 deletions

View File

@ -8,7 +8,7 @@ package net.i2p.router;
*
*/
import java.util.Iterator;
import java.util.Map;
import java.util.Properties;
import net.i2p.data.Hash;
@ -49,9 +49,9 @@ public class ClientTunnelSettings {
writeToProperties(p);
buf.append("Client tunnel settings:\n");
buf.append("====================================\n");
for (Iterator iter = p.keySet().iterator(); iter.hasNext(); ) {
String name = (String)iter.next();
String val = p.getProperty(name);
for (Map.Entry<Object, Object> entry : p.entrySet()) {
String name = (String) entry.getKey();
String val = (String) entry.getValue();
buf.append(name).append(" = [").append(val).append("]\n");
}
buf.append("====================================\n");

View File

@ -3,8 +3,6 @@ package net.i2p.router;
import java.io.IOException;
import java.io.Writer;
import java.util.Iterator;
import net.i2p.data.DataFormatException;
import net.i2p.data.Destination;
import net.i2p.data.Hash;
@ -43,8 +41,7 @@ public class PersistentKeyRing extends KeyRing {
}
private void addFromProperties() {
for (Iterator iter = _ctx.getPropertyNames().iterator(); iter.hasNext(); ) {
String prop = (String) iter.next();
for (String prop : _ctx.getPropertyNames()) {
if (!prop.startsWith(PROP_PFX))
continue;
String key = _ctx.getProperty(prop);

View File

@ -201,7 +201,7 @@ public class TunnelPoolSettings {
* @param prefix non-null
*/
public void readFromProperties(String prefix, Map<Object, Object> props) {
for (Map.Entry e : props.entrySet()) {
for (Map.Entry<Object, Object> e : props.entrySet()) {
String name = (String) e.getKey();
String value = (String) e.getValue();
if (name.startsWith(prefix)) {
@ -250,7 +250,7 @@ public class TunnelPoolSettings {
props.setProperty(prefix + PROP_IP_RESTRICTION, ""+_IPRestriction);
if (!_isInbound)
props.setProperty(prefix + PROP_PRIORITY, Integer.toString(_priority));
for (Map.Entry e : _unknownOptions.entrySet()) {
for (Map.Entry<Object, Object> e : _unknownOptions.entrySet()) {
String name = (String) e.getKey();
String val = (String) e.getValue();
props.setProperty(prefix + name, val);
@ -264,7 +264,7 @@ public class TunnelPoolSettings {
writeToProperties("", p);
buf.append("Tunnel pool settings:\n");
buf.append("====================================\n");
for (Map.Entry e : p.entrySet()) {
for (Map.Entry<Object, Object> e : p.entrySet()) {
String name = (String) e.getKey();
String val = (String) e.getValue();
buf.append(name).append(" = [").append(val).append("]\n");

View File

@ -280,8 +280,7 @@ class UPnP extends ControlPoint implements DeviceChangeListener, EventListener {
*/
private void discoverService() {
synchronized (lock) {
for (Iterator iter = _router.getDeviceList().iterator();iter.hasNext();) {
Device current = (Device)iter.next();
for (Device current : _router.getDeviceList()) {
if (!current.getDeviceType().equals(WAN_DEVICE))
continue;

View File

@ -69,7 +69,7 @@ class NTCPSendFinisher {
public CustomThreadPoolExecutor(int num) {
// use unbounded queue, so maximumPoolSize and keepAliveTime have no effect
super(num, num, 1000, TimeUnit.MILLISECONDS,
new LinkedBlockingQueue(), new CustomThreadFactory());
new LinkedBlockingQueue<Runnable>(), new CustomThreadFactory());
}
}

View File

@ -24,7 +24,7 @@ class ExploratoryPeerSelector extends TunnelPeerSelector {
super(context);
}
public List<Hash> selectPeers(TunnelPoolSettings settings) {
public List<Hash> selectPeers(TunnelPoolSettings settings) {
Log l = ctx.logManager().getLog(getClass());
int length = getLength(settings);
if (length < 0) {
@ -34,7 +34,7 @@ class ExploratoryPeerSelector extends TunnelPeerSelector {
}
if (false && shouldSelectExplicit(settings)) {
List rv = selectExplicit(settings, length);
List<Hash> rv = selectExplicit(settings, length);
if (l.shouldLog(Log.DEBUG))
l.debug("Explicit peers selected: " + rv);
return rv;

View File

@ -6,7 +6,7 @@ import java.util.Comparator;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.TreeSet;
import net.i2p.data.Hash;
@ -123,7 +123,8 @@ public class TunnelPool {
return; // don't override client specified settings
} else {
if (_settings.isExploratory()) {
Map props = _context.router().getConfigMap();
Properties props = new Properties();
props.putAll(_context.router().getConfigMap());
if (_settings.isInbound())
_settings.readFromProperties(TunnelPoolSettings.PREFIX_INBOUND_EXPLORATORY, props);
else