Closed GoogleCodeExporter closed 8 years ago
Cannot reproduce.
Please provide a complete failing test case if possible.
Original comment by mario.fu...@gmail.com
on 29 Jan 2012 at 10:35
import java.util.HashSet;
import java.util.Set;
import ch.lambdaj.Lambda;
public class LambdaJTest {
public static void main(String[] args) {
Set<CostItem> costItems = new HashSet<CostItem>();
CostItem costItem = new CostItem();
costItem.setCashOut(5f);
costItem.setTravel(10f);
costItems.add(costItem);
costItem = new CostItem();
costItem.setCashOut(2f);
costItem.setTravel(20f);
costItems.add(costItem);
costItem = new CostItem();
costItem.setCashOut(3f);
costItem.setTravel(30f);
costItems.add(costItem);
System.out.println(Lambda.sum(costItems , Lambda.on(CostItem.class).getCashOut()));
System.out.println(Lambda.sum(costItems , Lambda.on(CostItem.class).getTravel()));
// Prints out sum of travel, but should be cash out
System.out.println(Lambda.sum(costItems , Lambda.on(CostItem.class).getCashOut()));
}
}
import java.io.Serializable;
@SuppressWarnings("serial")
public class CostItem implements Serializable {
private int _ordinal = 0;
public static final String PROP_HOURS = "hours";
private float _hours;
public static final String PROP_TRAVEL = "travel";
private float _travel;
public static final String PROP_CASHOUT = "cashOut";
private float _cashOut;
public static final String PROP_MATERIALCOST = "materialCost";
private float _materialCost;
public static final String PROP_ENGINECOST = "engineCost";
private float _engineCost;
private long _nodeId;
private String _externalResourceName;
private int _role;
public static final String PROP_DESCRIPTION = "description";
private String _description;
public long getNodeId() {
return _nodeId;
}
public void setNodeId(long id) {
_nodeId = id;
}
public int getOrdinal() {
return _ordinal;
}
public void setOrdinal(int ordinal) {
_ordinal = ordinal;
}
public float getHours() {
return _hours;
}
public void setHours(float hours) {
_hours = hours;
}
public float getTravel() {
return _travel;
}
public void setTravel(float travel) {
_travel = travel;
}
public float getCashOut() {
return _cashOut;
}
public void setCashOut(float cashOut) {
_cashOut = cashOut;
}
public float getMaterialCost() {
return _materialCost;
}
public void setMaterialCost(float materialCost) {
_materialCost = materialCost;
}
public float getEngineCost() {
return _engineCost;
}
public void setEngineCost(float engineCost) {
_engineCost = engineCost;
}
public String getExternalResourceName() {
return _externalResourceName;
}
public void setExternalResourceName(String name) {
_externalResourceName = name;
}
public boolean isExternalResourceItem() {
return getExternalResourceName() != null;
}
public int getRole() {
return _role;
}
public void setRole(int role) {
_role = role;
}
public String getDescription() {
return _description;
}
public void setDescription(String description) {
_description = description;
}
public void appendDescription(String string) {
_description = (_description == null ? "" : _description) + string;
}
}
Original comment by j...@sci.fi
on 30 Jan 2012 at 8:55
Original comment by mario.fu...@gmail.com
on 4 Feb 2012 at 10:40
Fixed in release 2.4
Original comment by mario.fu...@gmail.com
on 4 Feb 2012 at 10:53
Original issue reported on code.google.com by
j...@sci.fi
on 22 Aug 2011 at 5:41