From: "Enrico Weigelt, metux IT consult" <enrico.weig...@gr13.net>
--- src/net/sf/freecol/common/model/AbstractGoods.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/net/sf/freecol/common/model/AbstractGoods.java b/src/net/sf/freecol/common/model/AbstractGoods.java index 5d2e67ca790..6b264951ba9 100644 --- a/src/net/sf/freecol/common/model/AbstractGoods.java +++ b/src/net/sf/freecol/common/model/AbstractGoods.java @@ -249,25 +249,21 @@ public class AbstractGoods extends FreeColObject implements Named { } /** - * find any in list by type + * find any in list with positive amount */ - public static AbstractGoods findByType(List<AbstractGoods> l, GoodsType gt) { + public static AbstractGoods findPositive(List<AbstractGoods> l) { if (l != null) for (AbstractGoods ag : l) - if (ag.getType() == gt) + if (ag.amount > 0) return ag; - return false; - } - - public static AbstractGoods findByType(List<AbstractGoods> l, AbstractGoods ag) { - return findByType(l, ag.getType()); + return null; } /** * find any in list by type */ - public static AbstractGoods findByType(List<AbstractGoods> l, GoodsType gt) { + public static AbstractGoods findByType(List<? extends AbstractGoods> l, GoodsType gt) { if (l != null) for (AbstractGoods ag : l) if (ag.getType() == gt) -- 2.11.0.rc0.7.gbe5a750 ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Freecol-developers mailing list Freecol-developers@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freecol-developers