HostInterfaces implements Serializable { public Set<HostInterfaceModel> filterByIp( final String pattern ) { Preconditions.checkNotNull( pattern ); Set<HostInterfaceModel> result = Sets.filter( interfaces, new Predicate<HostInterface>() { @Override public boolean apply( final HostInterface intf ) { return intf.getIp().matches( pattern ); } } ); return Collections.unmodifiableSet( result ); } HostInterfaces( @JsonProperty( "hostId" ) final String hostId,
                           @JsonProperty( "interfaces" ) final Set<HostInterfaceModel> interfaces );  HostInterfaces(); String getHostId(); HostInterfaceModel findByIp( final String ip ); HostInterfaceModel findByName( final String name ); Set<HostInterfaceModel> filterByIp( final String pattern ); Set<HostInterfaceModel> filterByName( final String pattern ); int size(); void addHostInterface( final HostInterfaceModel hostInterfaceModel ); @JsonIgnore Set<HostInterfaceModel> getAll(); @Override String toString();  }
@Test public void testFilterByIp() { Set<HostInterfaceModel> ifaces = hostInterfaces.filterByIp( "172.*" ); assertFalse( ifaces.isEmpty() ); }