mirror of
https://github.com/tiennm99/java-design-patterns.git
synced 2026-05-18 09:25:54 +00:00
Java 11 migrate all remaining s (#1120)
* Moves saga to Java 11 * Moves semaphore to Java 11 * Moves servant to Java 11 * Moves serverless to Java 11 * Moves service-layer to Java 11 * Moves service-locator to Java 11 * Moves sharding to Java 11 * Moves singleton to Java 11 * Moves spatial-partition to Java 11 * Moves specification to Java 11 * Moves state to Java 11 * Moves step-builder to Java 11 * Moves strategy to Java 11 * Moves subclass-sandbox to Java 11 * Fixes checkstyle issues
This commit is contained in:
committed by
Ilkka Seppälä
parent
310ae50248
commit
cd2a2e7711
@@ -23,7 +23,7 @@
|
||||
|
||||
package com.iluwatar.spatialpartition;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Random;
|
||||
import org.slf4j.Logger;
|
||||
@@ -64,10 +64,10 @@ public class Bubble extends Point<Bubble> {
|
||||
allBubbles.remove(this.id);
|
||||
}
|
||||
|
||||
void handleCollision(ArrayList<Point> bubblesToCheck, Hashtable<Integer, Bubble> allBubbles) {
|
||||
boolean toBePopped = false; //if any other bubble collides with it, made true
|
||||
for (int i = 0; i < bubblesToCheck.size(); i++) {
|
||||
Integer otherId = bubblesToCheck.get(i).id;
|
||||
void handleCollision(Collection<? extends Point> toCheck, Hashtable<Integer, Bubble> allBubbles) {
|
||||
var toBePopped = false; //if any other bubble collides with it, made true
|
||||
for (var point : toCheck) {
|
||||
var otherId = point.id;
|
||||
if (allBubbles.get(otherId) != null && //the bubble hasn't been popped yet
|
||||
this.id != otherId && //the two bubbles are not the same
|
||||
this.touches(allBubbles.get(otherId))) { //the bubbles touch
|
||||
|
||||
Reference in New Issue
Block a user