- 
                Notifications
    
You must be signed in to change notification settings  - Fork 45
 
Mixins : StreamableValue
        johnmcclean-aol edited this page Feb 24, 2016 
        ·
        3 revisions
      
    Cyclops has merged with simple-react. Please update your bookmarks (stars :) ) to https://github.com/aol/cyclops-react
All new develpoment on cyclops occurs in cyclops-react. Older modules are still available in maven central.
Implementing com.aol.cyclops.value.StreamableValue in cyclops-core extends the ValueObject interface and adds Streamable support and support for For Comprehensions.
Any Object can be coerced to a StreamableValue via the following methods
- AsStreamableValue.asStreamableValue
 - As.asStreamableValue
 
With Lombok @Value
     Stream<Double> withBonus = As.<Double>asStreamableValue(new BaseData(10.00,5.00,100.30))
				     .doWithThisAnd(d->asList(2.0))
			             .yield((Double base)->(Double bonus)-> base*(1.0+bonus));
	
	
	
  double total = withBonus.collect(Collectors.summingDouble(t->t));
	
  assertThat(total,equalTo(345.9));
    @Value static class BaseData{ double salary; double pension; double socialClub; }