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) {
325
325
* Avoids previous O(n^2) implementation which would be costly for
326
326
* lategame carrier fights
327
327
*/
328
- public List <Unit > getConnected (final Unit unit ) {
328
+ List <Unit > getConnected (final Unit unit ) {
329
329
final int frame = getFrameCount ();
330
330
if (lastConnectedUnitsUpdate < frame ) {
331
331
connectedUnits .clear ();
@@ -346,13 +346,13 @@ public List<Unit> getConnected(final Unit unit) {
346
346
if (!connectedUnits .containsKey (unit )) {
347
347
return Collections .emptyList ();
348
348
}
349
- return new ArrayList <> (connectedUnits .get (unit ));
349
+ return Collections . unmodifiableList (connectedUnits .get (unit ));
350
350
}
351
351
352
352
/**
353
353
* @see #getConnected
354
354
*/
355
- public List <Unit > getLoadedUnits (final Unit unit ) {
355
+ List <Unit > getLoadedUnits (final Unit unit ) {
356
356
final int frame = getFrameCount ();
357
357
if (lastLoadedUnitsUpdate < frame ) {
358
358
loadedUnits .clear ();
@@ -370,7 +370,7 @@ public List<Unit> getLoadedUnits(final Unit unit) {
370
370
if (!loadedUnits .containsKey (unit )) {
371
371
return Collections .emptyList ();
372
372
}
373
- return new ArrayList <> (loadedUnits .get (unit ));
373
+ return Collections . unmodifiableList (loadedUnits .get (unit ));
374
374
}
375
375
376
376
/**
You can’t perform that action at this time.
0 commit comments