From: "Enrico Weigelt, metux IT consult" <[email protected]>
---
.../gui/panel/report/CompactLabourReport.java | 29 +++++++++++-----------
1 file changed, 14 insertions(+), 15 deletions(-)
diff --git
a/src/net/sf/freecol/client/gui/panel/report/CompactLabourReport.java
b/src/net/sf/freecol/client/gui/panel/report/CompactLabourReport.java
index 39647d56565..5b5ed7d1611 100644
--- a/src/net/sf/freecol/client/gui/panel/report/CompactLabourReport.java
+++ b/src/net/sf/freecol/client/gui/panel/report/CompactLabourReport.java
@@ -26,9 +26,6 @@ import java.awt.event.ActionListener;
import java.util.Collections;
import java.util.Set;
-import java.util.function.Function;
-import java.util.function.Predicate;
-import java.util.stream.Collectors;
import javax.swing.ImageIcon;
import javax.swing.JButton;
@@ -344,20 +341,22 @@ public final class CompactLabourReport extends
ReportPanel {
if (allColonists) {
addRow(data, null, Messages.message("report.labour.sutdent"),
createNonCountedLabel(studentCount), 0, row);
} else {
- final Predicate<Unit> teachingPred = u -> {
- final Unit student = u.getStudent();
- return student != null && student.getType() == unitType;
- };
- final Function<Unit, UnitType> studentMapper = u ->
- unitType.getTeachingType(u.getType());
- Set<UnitType> resultOfTraining = (colony == null)
- ? Collections.<UnitType>emptySet()
- : transform(colony.getTeachers(), teachingPred,
- studentMapper, Collectors.toSet());
- String student = (resultOfTraining.size() == 1)
+ UnitType resultUnitType = null;
+ int found = 0;
+ if (colony != null) {
+ for (Unit u : colony.getTeachers()) {
+ final Unit student = u.getStudent();
+ if (student == null || (student.getType() == unitType))
+ continue;
+ resultUnitType = unitType.getTeachingType(u.getType());
+ found++;
+ }
+ }
+
+ String student = (found == 1)
? Messages.message(StringTemplate
.template("report.labour.learning")
- .addName("%unit%", first(resultOfTraining)))
+ .addName("%unit%", resultUnitType))
: Messages.message("report.labour.learningOther");
addRow(data,
data.getUnitData().getUnitName(),
--
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/freecol-developers