@Test public void collectValuesForKey() { final AppcacheLinker linker = new AppcacheLinker(); final ArrayList<SelectionDescriptor> bindings = new ArrayList<>(); final ArrayList<BindingProperty> binding0 = new ArrayList<>(); bp( binding0, "a", "z1" ); bp( binding0, "b", "z2" ); bindings.add( new SelectionDescriptor( "X", binding0 ) ); final HashSet<String> values0 = linker.collectValuesForKey( bindings, "a" ); assertEquals( values0.size(), 1 ); assertTrue( values0.contains( "z1" ) ); final ArrayList<BindingProperty> binding1 = new ArrayList<>(); bp( binding1, "a", "w1" ); bp( binding1, "b", "w2" ); bindings.add( new SelectionDescriptor( "X", binding1 ) ); final HashSet<String> values1 = linker.collectValuesForKey( bindings, "a" ); assertEquals( values1.size(), 2 ); assertTrue( values1.contains( "z1" ) ); assertTrue( values1.contains( "w1" ) ); }
@Nonnull final HashSet<String> collectValuesForKey( @Nonnull final List<SelectionDescriptor> selectors, @Nonnull final String key ) { final HashSet<String> values = new HashSet<>(); for ( final SelectionDescriptor selector : selectors ) { for ( final BindingProperty property : selector.getBindingProperties() ) { if ( property.getName().equals( key ) ) { values.add( property.getValue() ); } } } return values; }
AppcacheLinker extends AbstractLinker { @Nonnull final HashSet<String> collectValuesForKey( @Nonnull final List<SelectionDescriptor> selectors, @Nonnull final String key ) { final HashSet<String> values = new HashSet<>(); for ( final SelectionDescriptor selector : selectors ) { for ( final BindingProperty property : selector.getBindingProperties() ) { if ( property.getName().equals( key ) ) { values.add( property.getValue() ); } } } return values; } }
AppcacheLinker extends AbstractLinker { @Nonnull final HashSet<String> collectValuesForKey( @Nonnull final List<SelectionDescriptor> selectors, @Nonnull final String key ) { final HashSet<String> values = new HashSet<>(); for ( final SelectionDescriptor selector : selectors ) { for ( final BindingProperty property : selector.getBindingProperties() ) { if ( property.getName().equals( key ) ) { values.add( property.getValue() ); } } } return values; }  }
AppcacheLinker extends AbstractLinker { @Nonnull final HashSet<String> collectValuesForKey( @Nonnull final List<SelectionDescriptor> selectors, @Nonnull final String key ) { final HashSet<String> values = new HashSet<>(); for ( final SelectionDescriptor selector : selectors ) { for ( final BindingProperty property : selector.getBindingProperties() ) { if ( property.getName().equals( key ) ) { values.add( property.getValue() ); } } } return values; }  @Override String getDescription(); @Override ArtifactSet link( @Nonnull final TreeLogger logger,
                           @Nonnull final LinkerContext context,
                           @Nonnull final ArtifactSet artifacts,
                           final boolean onePermutation ); }
AppcacheLinker extends AbstractLinker { @Nonnull final HashSet<String> collectValuesForKey( @Nonnull final List<SelectionDescriptor> selectors, @Nonnull final String key ) { final HashSet<String> values = new HashSet<>(); for ( final SelectionDescriptor selector : selectors ) { for ( final BindingProperty property : selector.getBindingProperties() ) { if ( property.getName().equals( key ) ) { values.add( property.getValue() ); } } } return values; }  @Override String getDescription(); @Override ArtifactSet link( @Nonnull final TreeLogger logger,
                           @Nonnull final LinkerContext context,
                           @Nonnull final ArtifactSet artifacts,
                           final boolean onePermutation );  }