I defined a class Point that represents a point on an integer lattice. I have overridden methods for hashCode() and equals(Object).
HashMap does not seem to do anything when using HashMap.put(Point, Double) for Points with a coordinate value >= 128. No error is thrown, but attempting to access Points from the HashMap will result in the key not being found. I am well under INTEGER.MAX_VALUE, and have plenty of memory available.
Here is my Point class:
import java.util.ArrayList;
public class Point {
    protected int dimension;
    protected ArrayList<Integer> coordinates;
    public Point(int[] coordinates){
        this.coordinates = convertArray(coordinates);
        dimension = coordinates.length;
    }
    private ArrayList<Integer> convertArray(int[] array){
        ArrayList<Integer> newArray = new ArrayList<Integer>();
        for(int i = 0; i < array.length; i++){
            newArray.add(array[i]);
        }
        return newArray;
    }
    @Override
    public int hashCode(){
        // Some arbitrary quick hash
        return coordinates.get(0);
    }
    @Override
    public boolean equals(Object o){
        Point p = (Point)o;
        if(dimension != p.coordinates.size())
            return false;
        for(int i = 0; i < p.coordinates.size(); i++){
            if(coordinates.get(i) != p.coordinates.get(i)){
                return false;
            }
        }
        return true;
    }
}
and the test I ran:
import java.util.*;
public class random {
    public static void main(String[] args) {
        HashMap<Point, Double> weight = new HashMap<Point, Double>((int)(150 * 150 * .75 + 1));
        for(int i = 0; i < 150; i++){
            for(int j = 0; j < 150; j++){
                int [] tmpArray = {i, j};
                weight.put(new Point(tmpArray), Math.random());
            }
        }
        for(int i = 0; i < 150; i++){
            for(int j = 0; j < 150; j++){
                int [] tmpArray = {i, j};
                if(weight.get(new Point(tmpArray)) == null){
                    System.out.println("[" + i + ", " + j + "]: ");
                    System.out.println(weight.containsKey(new Point(tmpArray)));
                }
            }
        }
    }
}
Any ideas would be helpful. Thanks!
 
     
    