Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/bwapi/Bullet.java
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return Objects.hash(id);
return Integer.hashCode(id);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/bwapi/Color.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return Objects.hash(id);
return Integer.hashCode(id);
}

@Override
Expand Down
13 changes: 5 additions & 8 deletions src/main/java/bwapi/ConnectedUnitCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,18 +27,15 @@ List<Unit> getConnected(final Unit unit) {
for (final Unit u : game.getAllUnits()) {
final Unit owner = condition.apply(u);
if (owner != null) {
if (!connectedUnits.containsKey(owner)) {
connectedUnits.put(owner, new ArrayList<>());
}
connectedUnits.get(owner).add(u);
connectedUnits.computeIfAbsent(owner, k -> new ArrayList<>()).add(u);
}
}
lastUpdate = frame;
}
if (!connectedUnits.containsKey(unit)) {
return Collections.emptyList();
}
return Collections.unmodifiableList(connectedUnits.get(unit));
List<Unit> connected = connectedUnits.get(unit);
return connected == null ?
Collections.emptyList() :
Collections.unmodifiableList(connected);
}
void reset() {
lastUpdate = -1;
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/bwapi/Force.java
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return Objects.hash(id);
return Integer.hashCode(id);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/bwapi/Player.java
Original file line number Diff line number Diff line change
Expand Up @@ -848,7 +848,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return Objects.hash(id);
return Integer.hashCode(id);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/bwapi/Region.java
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return Objects.hash(id);
return Integer.hashCode(id);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/bwapi/Unit.java
Original file line number Diff line number Diff line change
Expand Up @@ -6345,7 +6345,7 @@ public boolean equals(Object o) {

@Override
public int hashCode() {
return Objects.hash(id);
return Integer.hashCode(id);
}

public int compareTo(final Unit other) {
Expand Down
Loading