diff --git a/megamek/src/megamek/common/equipment/WeaponMounted.java b/megamek/src/megamek/common/equipment/WeaponMounted.java index 48b39f59bd1..7e931a3d7b4 100644 --- a/megamek/src/megamek/common/equipment/WeaponMounted.java +++ b/megamek/src/megamek/common/equipment/WeaponMounted.java @@ -207,12 +207,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)) + .map(getEntity().getWeapon) .filter(Objects::nonNull) + } + + /** + * @return All the weapon mounts in the bay. + */ + public List getBayWeapons() { + return streamBayWeapons() .collect(Collectors.toList()); }