jurt: Enhanced For-Loops
Change-Id: I74a9b8afd1e4a1364c61c7b85277909f38611f6d Reviewed-on: https://gerrit.libreoffice.org/10553 Reviewed-by: David Tardon <dtardon@redhat.com> Tested-by: David Tardon <dtardon@redhat.com>
This commit is contained in:
@@ -296,10 +296,7 @@ public class ServiceManager implements XMultiServiceFactory,
|
||||
throws com.sun.star.uno.RuntimeException
|
||||
{
|
||||
if (eventListener != null) {
|
||||
java.util.Iterator<XEventListener> enumer = eventListener.iterator();
|
||||
|
||||
while (enumer.hasNext()) {
|
||||
XEventListener listener = enumer.next();
|
||||
for (XEventListener listener : eventListener) {
|
||||
listener.disposing(new com.sun.star.lang.EventObject(this));
|
||||
}
|
||||
eventListener.clear();
|
||||
@@ -468,16 +465,17 @@ public class ServiceManager implements XMultiServiceFactory,
|
||||
|
||||
String[] serviceNames = xServiceInfo.getSupportedServiceNames();
|
||||
|
||||
for ( int i=0; i<serviceNames.length; i++ ) {
|
||||
if ( factoriesByServiceNames.containsKey( serviceNames[i] ) ) {
|
||||
ArrayList<Object> vec = factoriesByServiceNames.get(serviceNames[i]);
|
||||
|
||||
if ( !vec.remove(object) )
|
||||
for (String serviceName : serviceNames) {
|
||||
if (factoriesByServiceNames.containsKey(serviceName)) {
|
||||
ArrayList<Object> vec = factoriesByServiceNames.get(serviceName);
|
||||
if (!vec.remove(object)) {
|
||||
System.err.println("The implementation " + xServiceInfo.getImplementationName() +
|
||||
" is not registered for the service " + serviceNames[i] + " - ignoring!");
|
||||
|
||||
if ( vec.isEmpty() ) // remove the vector if no implementations aviable for the service
|
||||
factoriesByServiceNames.remove( serviceNames[i] );
|
||||
" is not registered for the service " + serviceName + " - ignoring!");
|
||||
}
|
||||
// remove the vector if no implementations aviable for the service
|
||||
if (vec.isEmpty()) {
|
||||
factoriesByServiceNames.remove(serviceName);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -565,11 +563,13 @@ public class ServiceManager implements XMultiServiceFactory,
|
||||
public boolean supportsService( String serviceName )
|
||||
throws com.sun.star.uno.RuntimeException
|
||||
{
|
||||
for (int i=0; i<supportedServiceNames.length; i++)
|
||||
if (supportedServiceNames[i].equals( serviceName )) return true;
|
||||
for (String supportedServiceName : supportedServiceNames) {
|
||||
if (supportedServiceName.equals(serviceName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return getImplementationName().equals(serviceName);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -19,7 +19,6 @@ package com.sun.star.lib.connections.pipe;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import com.sun.star.connection.XConnection;
|
||||
@@ -103,25 +102,19 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster {
|
||||
}
|
||||
|
||||
private void notifyListeners_open() {
|
||||
Iterator<XStreamListener> elements = _aListeners.iterator();
|
||||
while(elements.hasNext()) {
|
||||
XStreamListener xStreamListener = elements.next();
|
||||
for (XStreamListener xStreamListener : _aListeners) {
|
||||
xStreamListener.started();
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyListeners_close() {
|
||||
Iterator<XStreamListener> elements = _aListeners.iterator();
|
||||
while(elements.hasNext()) {
|
||||
XStreamListener xStreamListener = elements.next();
|
||||
for (XStreamListener xStreamListener : _aListeners) {
|
||||
xStreamListener.closed();
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyListeners_error(com.sun.star.uno.Exception exception) {
|
||||
Iterator<XStreamListener> elements = _aListeners.iterator();
|
||||
while(elements.hasNext()) {
|
||||
XStreamListener xStreamListener = elements.next();
|
||||
for (XStreamListener xStreamListener : _aListeners) {
|
||||
xStreamListener.error(exception);
|
||||
}
|
||||
}
|
||||
@@ -215,4 +208,3 @@ public class PipeConnection implements XConnection, XConnectionBroadcaster {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@@ -25,7 +25,6 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.Socket;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
import com.sun.star.connection.XConnection;
|
||||
import com.sun.star.connection.XConnectionBroadcaster;
|
||||
@@ -89,25 +88,19 @@ public class SocketConnection implements XConnection, XConnectionBroadcaster {
|
||||
}
|
||||
|
||||
private void notifyListeners_open() {
|
||||
Iterator<XStreamListener> elements = _listeners.iterator();
|
||||
while(elements.hasNext()) {
|
||||
XStreamListener xStreamListener = elements.next();
|
||||
for (XStreamListener xStreamListener : _listeners) {
|
||||
xStreamListener.started();
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyListeners_close() {
|
||||
Iterator<XStreamListener> elements = _listeners.iterator();
|
||||
while(elements.hasNext()) {
|
||||
XStreamListener xStreamListener = elements.next();
|
||||
for (XStreamListener xStreamListener : _listeners) {
|
||||
xStreamListener.closed();
|
||||
}
|
||||
}
|
||||
|
||||
private void notifyListeners_error(com.sun.star.uno.Exception exception) {
|
||||
Iterator<XStreamListener> elements = _listeners.iterator();
|
||||
while(elements.hasNext()) {
|
||||
XStreamListener xStreamListener = elements.next();
|
||||
for (XStreamListener xStreamListener : _listeners) {
|
||||
xStreamListener.error(exception);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user