Source:
<code>protected void addNetworkMainInfo(VmNetworkInterface networkInterface, HasWidgets targetPanel) { DListElement dl = Document.get().createDLElement(); StringBuilder ipv4AddressBuilder = new StringBuilder(); StringBuilder ipv6AddressBuilder = new StringBuilder(); FlowPanel infoPanel = new FlowPanel(); <START> for (VmGuestAgentInterface guestAgentInterface: allGuestAgentData) { <END> if (guestAgentInterface.getIpv4Addresses() != null) { if (ipv4AddressBuilder.length() != 0) { ipv4AddressBuilder.append(", "); } ipv4AddressBuilder.append(guestAgentInterface.getIpv4Addresses()); } if (guestAgentInterface.getIpv6Addresses() != null) { if (ipv6AddressBuilder.length() != 0) { ipv6AddressBuilder.append(", "); } ipv6AddressBuilder.append(guestAgentInterface.getIpv6Addresses()); } } String ipv4Address; if (ipv4AddressBuilder.length() == 0) { ipv4Address = constants.notAvailableLabel(); } else { ipv4Address = ipv4AddressBuilder.toString(); } String ipv6Address; if (ipv6AddressBuilder.length() == 0) { ipv6Address = constants.notAvailableLabel(); } else { ipv6Address = ipv6AddressBuilder.toString(); } addStackedDetailItem(SafeHtmlUtils.fromSafeConstant(constants.networkNameInterface()), networkInterface.getNetworkName() != null ? networkInterface.getNetworkName() : constants.unAvailablePropertyLabel(), dl); addStackedDetailItem(SafeHtmlUtils.fromSafeConstant(constants.ipv4VmGuestAgent()), ipv4Address, dl); addStackedDetailItem(SafeHtmlUtils.fromSafeConstant(constants.ipv6VmGuestAgent()), ipv6Address, dl); addStackedDetailItem(SafeHtmlUtils.fromSafeConstant(constants.macVmGuestAgent()), networkInterface.getMacAddress(), dl); infoPanel.getElement().appendChild(dl); targetPanel.add(infoPanel); }</code><technical_language>stream reads nice declarative SQL: "select ipv4addresses obj" basically. loop figure out logic. some point, decide want abandon of loops! (j/k)</technical_language>

Target:
protected void addNetworkMainInfo(VmNetworkInterface networkInterface, HasWidgets targetPanel) { DListElement dl = Document.get().createDLElement(); StringBuilder ipv4AddressBuilder = new StringBuilder(); StringBuilder ipv6AddressBuilder = new StringBuilder(); FlowPanel infoPanel = new FlowPanel(); for (VmGuestAgentInterface guestAgentInterface: allGuestAgentData) { if (guestAgentInterface.getIpv4Addresses() != null) { if (ipv4AddressBuilder.length() != 0) { ipv4AddressBuilder.append(COMMA_DELIMITOR); } ipv4AddressBuilder.append( guestAgentInterface.getIpv4Addresses().stream().collect(Collectors.joining(COMMA_DELIMITOR))); } if (guestAgentInterface.getIpv6Addresses() != null) { if (ipv6AddressBuilder.length() != 0) { ipv6AddressBuilder.append(COMMA_DELIMITOR); } ipv6AddressBuilder.append( guestAgentInterface.getIpv6Addresses().stream().collect(Collectors.joining(COMMA_DELIMITOR))); } } String ipv4Address; if (ipv4AddressBuilder.length() == 0) { ipv4Address = constants.notAvailableLabel(); } else { ipv4Address = ipv4AddressBuilder.toString(); } String ipv6Address; if (ipv6AddressBuilder.length() == 0) { ipv6Address = constants.notAvailableLabel(); } else { ipv6Address = ipv6AddressBuilder.toString(); } addStackedDetailItem(SafeHtmlUtils.fromSafeConstant(constants.networkNameInterface()), networkInterface.getNetworkName() != null ? networkInterface.getNetworkName() : constants.unAvailablePropertyLabel(), dl); addStackedDetailItem(SafeHtmlUtils.fromSafeConstant(constants.ipv4VmGuestAgent()), ipv4Address, dl); addStackedDetailItem(SafeHtmlUtils.fromSafeConstant(constants.ipv6VmGuestAgent()), ipv6Address, dl); addStackedDetailItem(SafeHtmlUtils.fromSafeConstant(constants.macVmGuestAgent()), networkInterface.getMacAddress(), dl); infoPanel.getElement().appendChild(dl); targetPanel.add(infoPanel); }