import java.util.*;
import java.io.*;

public class Map
{
    public  Map (String fileToLoad)
    {
        _theMap = new Vector<MapEntry>();

        if (!loadData(fileToLoad))
            System.out.println("Error in loading data file: "+fileToLoad);
    }

    public final int getHeight ()
    {
        return _height;
    }

    public final int getWidth ()
    {
        return _width;
    }

    public long detectableAsteroids (Vector<Asteroid> theList, Asteroid from)
    {
        
        return theList.stream()
                .map(asteroid -> from.angleTo(asteroid))
                .distinct().count();
    }

    public long maxDetectableAsteroid () 
    {
        /*
         * Remove all empty items before we search so we can
         * ignore comparisons with space.
         */

        Vector<Asteroid> allAsteroids = new Vector<Asteroid>();
        Enumeration<MapEntry> iter = _theMap.elements();

        while (iter.hasMoreElements())
        {
            MapEntry item = iter.nextElement();

            if (item instanceof Asteroid)
                allAsteroids.add((Asteroid) item);
        }

        return allAsteroids.stream()
                .mapToLong(asteroid -> detectableAsteroids(allAsteroids, asteroid))
                .max().getAsLong();
    }

    private final boolean loadData (String file)
    {
        BufferedReader reader = null;
        boolean valid = true;

        try
        {
            reader = new BufferedReader(new FileReader(file));
            String line = null;

            while ((line = reader.readLine()) != null)
            {
                char[] asChar = line.toCharArray();
                
                if (_width == 0)
                    _width = asChar.length;

                for (int i = 0; i < _width; i++)
                {
                    if (asChar[i] == Asteroid.ASTEROID_REPRESENTATION)
                    {
                        _theMap.add(new Asteroid(_height, i));
                    }
                    else
                    {
                        if (asChar[i] == Empty.EMPTY_REPRESENTATION)
                        {
                            _theMap.add(new Empty(_height, i));
                        }
                        else
                        {
                            System.out.println("Unknown character in data file: "+asChar[i]);

                            valid = false;
                        }
                    }
                }

                _height++;

            }
        }
        catch (Throwable ex)
        {
            valid = false;

            ex.printStackTrace();
        }
        finally
        {
            try
            {
                reader.close();
            }
            catch (Throwable ex)
            {
            }
        }

        return valid;
    }

    @Override
    public String toString ()
    {
        int xAxis = 0;
        Enumeration<MapEntry> iter = _theMap.elements();
        String str = "";

        while (iter.hasMoreElements())
        {
            MapEntry theEntry = iter.nextElement();

            if (theEntry.getPosition().getX() != xAxis)
            {
                xAxis = theEntry.getPosition().getX();
                str += "\n";
            }

            str += theEntry.toString();
        }

        return str;
    }

    private Vector<MapEntry> _theMap;
    private int _height = 0;
    private int _width = 0;
}
@@ -401,228 +401,113 @@
     
-public long detectableAsteroids (Vector%3CAsteroid%3E theList, Asteroid from)%0A    %7B%0A        %0A        return theList.stream()%0A                .map(asteroid -%3E from.angleTo(asteroid))%0A                .distinct().count();
+/*%0A     * Stream through all of the asteroids and get the%0A     * count of visible items for each.
 %0A    
-%7D
+ */
 %0A%0A  
@@ -515,16 +515,22 @@
  public 
+final 
 long max
@@ -1165,32 +1165,284 @@
 sLong();%0A    %7D%0A%0A
+    // not working yet ...%0A%0A    private final long detectableAsteroids (Vector%3CAsteroid%3E theList, Asteroid from)%0A    %7B%0A        return theList.stream()%0A                .map(asteroid -%3E from.angleTo(asteroid))%0A                .distinct().count();%0A    %7D%0A%0A
     private fina

Update Map.java