File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ public boolean equals(Object o) {
197197
198198 @ Override
199199 public int hashCode () {
200- return Objects . hash (id );
200+ return Integer . hashCode (id );
201201 }
202202
203203 @ Override
Original file line number Diff line number Diff line change @@ -190,7 +190,7 @@ public boolean equals(Object o) {
190190
191191 @ Override
192192 public int hashCode () {
193- return Objects . hash (id );
193+ return Integer . hashCode (id );
194194 }
195195
196196 @ Override
Original file line number Diff line number Diff line change @@ -27,18 +27,15 @@ List<Unit> getConnected(final Unit unit) {
2727 for (final Unit u : game .getAllUnits ()) {
2828 final Unit owner = condition .apply (u );
2929 if (owner != null ) {
30- if (!connectedUnits .containsKey (owner )) {
31- connectedUnits .put (owner , new ArrayList <>());
32- }
33- connectedUnits .get (owner ).add (u );
30+ connectedUnits .computeIfAbsent (owner , k -> new ArrayList <>()).add (u );
3431 }
3532 }
3633 lastUpdate = frame ;
3734 }
38- if (! connectedUnits .containsKey (unit )) {
39- return Collections . emptyList ();
40- }
41- return Collections .unmodifiableList (connectedUnits . get ( unit ) );
35+ List < Unit > connected = connectedUnits .get (unit );
36+ return connected == null ?
37+ Collections . emptyList () :
38+ Collections .unmodifiableList (connected );
4239 }
4340 void reset () {
4441 lastUpdate = -1 ;
Original file line number Diff line number Diff line change @@ -64,7 +64,7 @@ public boolean equals(Object o) {
6464
6565 @ Override
6666 public int hashCode () {
67- return Objects . hash (id );
67+ return Integer . hashCode (id );
6868 }
6969
7070 @ Override
Original file line number Diff line number Diff line change @@ -848,7 +848,7 @@ public boolean equals(Object o) {
848848
849849 @ Override
850850 public int hashCode () {
851- return Objects . hash (id );
851+ return Integer . hashCode (id );
852852 }
853853
854854 @ Override
Original file line number Diff line number Diff line change @@ -250,7 +250,7 @@ public boolean equals(Object o) {
250250
251251 @ Override
252252 public int hashCode () {
253- return Objects . hash (id );
253+ return Integer . hashCode (id );
254254 }
255255
256256 @ Override
Original file line number Diff line number Diff line change @@ -6345,7 +6345,7 @@ public boolean equals(Object o) {
63456345
63466346 @ Override
63476347 public int hashCode () {
6348- return Objects . hash (id );
6348+ return Integer . hashCode (id );
63496349 }
63506350
63516351 public int compareTo (final Unit other ) {
You can’t perform that action at this time.
0 commit comments