A quadtree can be used to minimize the amount of collision checks needed for collision detection.
I'm using Kha to visualize the collisions but the classes can easily be adapted for use with a different framework. You can see the quadtree in action here.