public static HashMap<Long, LinkedList<Long>> readAndMapTestFile (String filePath, boolean indexByUser) throws FileNotFoundException{
	    HashMap<Long, LinkedList<Long>> userItemPair = new HashMap<Long, LinkedList<Long>>();
		
	    Scanner scan = new Scanner(new File(filePath));
	    String line = null;
	    
	    //read and ignore first line (headers)
	    line = scan.nextLine();
	    
	    do {
	      line = scan.nextLine();
	      String[] pair = line.split(",");
	      if(pair.length != 2){
	    	  System.err.println("Error: test file has wrong format. It must be a 2-column CSV.");
	    	  System.exit(1);
	      }
	      long item = Long.parseLong(pair[0].trim());
	      long user = Long.parseLong(pair[1].trim());
	      
	      if(indexByUser){
	    	  if(userItemPair.containsKey(user) && !userItemPair.get(user).contains(item)){
	    		  userItemPair.get(user).add(item);
	    	  }
	    	  else{
	    		  LinkedList<Long> ll = new LinkedList<Long>();
	    		  ll.add(item);
	    		  userItemPair.put(user, ll);
	    	  }
	      }
	      else{
	    	  if(userItemPair.containsKey(item) && !userItemPair.get(item).contains(user)){
	    		  userItemPair.get(item).add(user);
	    	  }
	    	  else{
	    		  LinkedList<Long> ll = new LinkedList<Long>();
	    		  ll.add(user);
	    		  userItemPair.put(item, ll);
	    	  }
	      }

	    } while (scan.hasNext());
	    
	    //sort each list
	    for(long element : userItemPair.keySet()){
	    	Collections.sort(userItemPair.get(element));
	    }
	    
		return userItemPair;
	}