Java中增强的for循环

Java中增强的for循环,java,for-loop,Java,For Loop,我有以下增强的for循环,我不明白它是如何工作的。有人能给我解释一下这个例子吗 @Path("vm") public class VmResource { @GET @Produces("application/json") public List<HostDetail> getVms() { VirtualBoxManager manager = VirtualBoxManager.createInstance(null);

我有以下增强的for循环,我不明白它是如何工作的。有人能给我解释一下这个例子吗

@Path("vm")
public class VmResource {

    @GET
    @Produces("application/json")
    public List<HostDetail> getVms() {
        VirtualBoxManager manager = VirtualBoxManager.createInstance(null);

        List<HostDetail> machineValues = new ArrayList<HostDetail>();

        for (String hostUri : PropertiesBean.getInstance().getServices()) {
            try {
                manager.connect(hostUri, PropertiesBean.getInstance().getUsername(), PropertiesBean.getInstance().getPassword());
                IVirtualBox vbox = manager.getVBox();
                IHost host = vbox.getHost();

                URL url = null;
                try {
                    url = new URL(hostUri);
                } catch (MalformedURLException ex) {
                    Logger.getLogger(VmResource.class.getName()).log(Level.SEVERE, null, ex);
                }

                HostDetail hostDetail = createHostDetail(host, url.toString(), 
                        vbox.getVersion(), url.getHost());
                for (IMachine machine : vbox.getMachines()) {
                    hostDetail.getVirtualMachines().add(createMachineDetail(machine));
                }
                machineValues.add(hostDetail);
            } catch (Exception ex) {

            } finally {
                manager.disconnect();
            }
        }
        return machineValues;
    }
比如,

有点像

Iterator<String> iter = PropertiesBean.getInstance().getServices();
for (; iter.hasNext();) {
    String hostUri = iter.next();
String[] arr = PropertiesBean.getInstance().getServices();
for (int i = 0; i < arr.length; i++) {
    String hostUri = arr[i];

你不明白这段代码的哪一部分?嗨,艾略特。谢谢你的回复。这有助于我坚持到底。
String[] arr = PropertiesBean.getInstance().getServices();
for (int i = 0; i < arr.length; i++) {
    String hostUri = arr[i];