Kaydet (Commit) dfb1d56b authored tarafından rbuj's avatar rbuj Kaydeden (comit) David Tardon

jurt: Enhanced For-Loops

Change-Id: I74a9b8afd1e4a1364c61c7b85277909f38611f6d
Reviewed-on: https://gerrit.libreoffice.org/10553Reviewed-by: 's avatarDavid Tardon <dtardon@redhat.com>
Tested-by: 's avatarDavid Tardon <dtardon@redhat.com>
üst c2e2ac63
...@@ -296,10 +296,7 @@ public class ServiceManager implements XMultiServiceFactory, ...@@ -296,10 +296,7 @@ public class ServiceManager implements XMultiServiceFactory,
throws com.sun.star.uno.RuntimeException throws com.sun.star.uno.RuntimeException
{ {
if (eventListener != null) { if (eventListener != null) {
java.util.Iterator<XEventListener> enumer = eventListener.iterator(); for (XEventListener listener : eventListener) {
while (enumer.hasNext()) {
XEventListener listener = enumer.next();
listener.disposing(new com.sun.star.lang.EventObject(this)); listener.disposing(new com.sun.star.lang.EventObject(this));
} }
eventListener.clear(); eventListener.clear();
...@@ -468,16 +465,17 @@ public class ServiceManager implements XMultiServiceFactory, ...@@ -468,16 +465,17 @@ public class ServiceManager implements XMultiServiceFactory,
String[] serviceNames = xServiceInfo.getSupportedServiceNames(); String[] serviceNames = xServiceInfo.getSupportedServiceNames();
for ( int i=0; i<serviceNames.length; i++ ) { for (String serviceName : serviceNames) {
if ( factoriesByServiceNames.containsKey( serviceNames[i] ) ) { if (factoriesByServiceNames.containsKey(serviceName)) {
ArrayList<Object> vec = factoriesByServiceNames.get(serviceNames[i]); ArrayList<Object> vec = factoriesByServiceNames.get(serviceName);
if (!vec.remove(object)) {
if ( !vec.remove(object) )
System.err.println("The implementation " + xServiceInfo.getImplementationName() + System.err.println("The implementation " + xServiceInfo.getImplementationName() +
" is not registered for the service " + serviceNames[i] + " - ignoring!"); " is not registered for the service " + serviceName + " - ignoring!");
}
if ( vec.isEmpty() ) // remove the vector if no implementations aviable for the service // remove the vector if no implementations aviable for the service
factoriesByServiceNames.remove( serviceNames[i] ); if (vec.isEmpty()) {
factoriesByServiceNames.remove(serviceName);
}
} }
} }
} }
...@@ -565,12 +563,14 @@ public class ServiceManager implements XMultiServiceFactory, ...@@ -565,12 +563,14 @@ public class ServiceManager implements XMultiServiceFactory,
public boolean supportsService( String serviceName ) public boolean supportsService( String serviceName )
throws com.sun.star.uno.RuntimeException throws com.sun.star.uno.RuntimeException
{ {
for (int i=0; i<supportedServiceNames.length; i++) for (String supportedServiceName : supportedServiceNames) {
if (supportedServiceNames[i].equals( serviceName )) return true; if (supportedServiceName.equals(serviceName)) {
return true;
}
}
return getImplementationName().equals(serviceName); return getImplementationName().equals(serviceName);
}
}
/** /**
* Supplies list of all supported services. * Supplies list of all supported services.
......
...@@ -19,7 +19,6 @@ package com.sun.star.lib.connections.pipe; ...@@ -19,7 +19,6 @@ package com.sun.star.lib.connections.pipe;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import com.sun.star.connection.XConnection; import com.sun.star.connection.XConnection;
...@@ -103,25 +102,19 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { ...@@ -103,25 +102,19 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster {
} }
private void notifyListeners_open() { private void notifyListeners_open() {
Iterator<XStreamListener> elements = _aListeners.iterator(); for (XStreamListener xStreamListener : _aListeners) {
while(elements.hasNext()) {
XStreamListener xStreamListener = elements.next();
xStreamListener.started(); xStreamListener.started();
} }
} }
private void notifyListeners_close() { private void notifyListeners_close() {
Iterator<XStreamListener> elements = _aListeners.iterator(); for (XStreamListener xStreamListener : _aListeners) {
while(elements.hasNext()) {
XStreamListener xStreamListener = elements.next();
xStreamListener.closed(); xStreamListener.closed();
} }
} }
private void notifyListeners_error(com.sun.star.uno.Exception exception) { private void notifyListeners_error(com.sun.star.uno.Exception exception) {
Iterator<XStreamListener> elements = _aListeners.iterator(); for (XStreamListener xStreamListener : _aListeners) {
while(elements.hasNext()) {
XStreamListener xStreamListener = elements.next();
xStreamListener.error(exception); xStreamListener.error(exception);
} }
} }
...@@ -215,4 +208,3 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster { ...@@ -215,4 +208,3 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster {
} }
} }
...@@ -25,7 +25,6 @@ import java.io.InputStream; ...@@ -25,7 +25,6 @@ import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.net.Socket; import java.net.Socket;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator;
import com.sun.star.connection.XConnection; import com.sun.star.connection.XConnection;
import com.sun.star.connection.XConnectionBroadcaster; import com.sun.star.connection.XConnectionBroadcaster;
...@@ -89,25 +88,19 @@ public class SocketConnection implements XConnection, XConnectionBroadcaster { ...@@ -89,25 +88,19 @@ public class SocketConnection implements XConnection, XConnectionBroadcaster {
} }
private void notifyListeners_open() { private void notifyListeners_open() {
Iterator<XStreamListener> elements = _listeners.iterator(); for (XStreamListener xStreamListener : _listeners) {
while(elements.hasNext()) {
XStreamListener xStreamListener = elements.next();
xStreamListener.started(); xStreamListener.started();
} }
} }
private void notifyListeners_close() { private void notifyListeners_close() {
Iterator<XStreamListener> elements = _listeners.iterator(); for (XStreamListener xStreamListener : _listeners) {
while(elements.hasNext()) {
XStreamListener xStreamListener = elements.next();
xStreamListener.closed(); xStreamListener.closed();
} }
} }
private void notifyListeners_error(com.sun.star.uno.Exception exception) { private void notifyListeners_error(com.sun.star.uno.Exception exception) {
Iterator<XStreamListener> elements = _listeners.iterator(); for (XStreamListener xStreamListener : _listeners) {
while(elements.hasNext()) {
XStreamListener xStreamListener = elements.next();
xStreamListener.error(exception); xStreamListener.error(exception);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment