private HashMap<String, Double> getPearsonSimilarityRating(String username, List<GigUsers> usersGigDictionary) {
        HashMap<String, Double> pearsonSimilarityCoefficient = new HashMap<String, Double>();
        GigUsers givenUser = new GigUsers(username);
        for (GigUsers gigUser : usersGigDictionary){
            if (givenUser.getUsername().equalsIgnoreCase(gigUser.getUsername())) {
                givenUser = gigUser;                
                break;
            }
        }
        List<URL> givenUserURLList = givenUser.getGigURLList();
        List<Integer> givenUserVoteList = givenUser.getGigVoteList();
        //to turn given user preferences (gig & vote) into a HashMap to make searchng & retrieval easier
        HashMap<URL, Integer> givenUserPreference = new HashMap<URL, Integer>();
        for (int i=0; i<givenUserURLList.size(); i++){
            givenUserPreference.put(givenUserURLList.get(i), givenUserVoteList.get(i));
        }
        
        //to compare given user with the dictionary
        for (GigUsers gigUser : usersGigDictionary) { 
  
            int score1=0, score2=0, sum1=0, sum2=0, sum1sq=0, sum2sq=0, psum=0, n=0;
            double num=0, den=0, pCoefficient=0.0;          
            List<URL> gigURLList = gigUser.getGigURLList();
            List<Integer> gigVoteList = gigUser.getGigVoteList();            
            HashMap<URL, Integer> currentUserPreference = new HashMap<URL, Integer>();
            for (int i=0; i<gigURLList.size(); i++){
                currentUserPreference.put(gigURLList.get(i), gigVoteList.get(i));
            }
            //to now go through the list of all gigs where given user and current user in dictionary have provided votes
            for (URL k : givenUserPreference.keySet()) {                 
                if (currentUserPreference.containsKey(k)) {
                    //getting the vote for each user
                    score1=givenUserPreference.get(k);
                    score2=currentUserPreference.get(k);                    
                    //Adding up all the preferences
                    sum1+=score1;
                    sum2+=score2;                    
                    //Adding up all the squares
                    sum1sq+=Math.pow(score1,2);
                    sum2sq+=Math.pow(score2,2);                    
                    //Adding up the products
                    psum+=score1*score2;
                    n++;
                }                
            }         
            //to calculate the pearson correlation score
            if (n==0) {
                den=0;
            }else {
                num=psum-(sum1*sum2/n);
                den=Math.sqrt(((sum1sq-Math.pow(sum1,2)/n)) * ((sum2sq-Math.pow(sum2,2)/n)));
            }
            if (den==0) {
                pCoefficient=0;
            }else{
                pCoefficient = num/den;
            }           
            pearsonSimilarityCoefficient.put(gigUser.getUsername(), pCoefficient);
        } 
         return pearsonSimilarityCoefficient; // returning the scores store to the calling method
    }