Nested Collections

18 views
Skip to first unread message

Damian O' Neill

unread,
Feb 21, 2014, 4:51:03 PM2/21/14
to lam...@googlegroups.com
Hi I was hoping you could help with the following.  I have a method that filters on a collection type, the collection contains multiple nested collections.  See below for an example of an instance expansion.

// networkServiceList.get(0).getServiceNetworkElements().get(0).getSwitchList().get(0).getServicePortList().get(0).getType().equals(L2PortType.UNI);

Can you clarify what is wrong with the method below.  

Thanks,
Damian.


    private List<NetworkService> getServicesWithUNIs(List<NetworkService> networkServiceList) {
        return select(networkServiceList,
                having(on(NetworkService.class).getServiceNetworkElements(),
                        having(on(ServiceNetworkElement.class).getSwitchList(),
                                having(on(ServiceSwitch.class).getServicePortList(),
                                        hasItem(having(on(ServicePort.class).getType(), equalTo(L2PortType.UNI)))))));
    }
Reply all
Reply to author
Forward
0 new messages