diff --git a/megamek/src/megamek/common/equipment/WeaponMounted.java b/megamek/src/megamek/common/equipment/WeaponMounted.java index 48b39f59bd1..ca685cc00d4 100644 --- a/megamek/src/megamek/common/equipment/WeaponMounted.java +++ b/megamek/src/megamek/common/equipment/WeaponMounted.java @@ -30,6 +30,7 @@ import java.util.Objects; import java.util.Vector; import java.util.stream.Collectors; +import java.util.stream.Stream; public class WeaponMounted extends Mounted { @@ -207,12 +208,19 @@ public void clearBayWeapons() { } /** - * @return All the weapon mounts in the bay. + * @return A stream containing the weapon mounts in the bay. */ - public List getBayWeapons() { + public Stream streamBayWeapons() { return bayWeapons.stream() .map(i -> getEntity().getWeapon(i)) - .filter(Objects::nonNull) + .filter(Objects::nonNull); + } + + /** + * @return All the weapon mounts in the bay. + */ + public List getBayWeapons() { + return streamBayWeapons() .collect(Collectors.toList()); }