File tree Expand file tree Collapse file tree 1 file changed +4
-4
lines changed
Expand file tree Collapse file tree 1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -325,7 +325,7 @@ void onFrame(final int frame) {
325325 * Avoids previous O(n^2) implementation which would be costly for
326326 * lategame carrier fights
327327 */
328- public List <Unit > getConnected (final Unit unit ) {
328+ List <Unit > getConnected (final Unit unit ) {
329329 final int frame = getFrameCount ();
330330 if (lastConnectedUnitsUpdate < frame ) {
331331 connectedUnits .clear ();
@@ -346,13 +346,13 @@ public List<Unit> getConnected(final Unit unit) {
346346 if (!connectedUnits .containsKey (unit )) {
347347 return Collections .emptyList ();
348348 }
349- return new ArrayList <> (connectedUnits .get (unit ));
349+ return Collections . unmodifiableList (connectedUnits .get (unit ));
350350 }
351351
352352 /**
353353 * @see #getConnected
354354 */
355- public List <Unit > getLoadedUnits (final Unit unit ) {
355+ List <Unit > getLoadedUnits (final Unit unit ) {
356356 final int frame = getFrameCount ();
357357 if (lastLoadedUnitsUpdate < frame ) {
358358 loadedUnits .clear ();
@@ -370,7 +370,7 @@ public List<Unit> getLoadedUnits(final Unit unit) {
370370 if (!loadedUnits .containsKey (unit )) {
371371 return Collections .emptyList ();
372372 }
373- return new ArrayList <> (loadedUnits .get (unit ));
373+ return Collections . unmodifiableList (loadedUnits .get (unit ));
374374 }
375375
376376 /**
You can’t perform that action at this time.
0 commit comments