public Friend getFriendAt(int index, boolean fromOnline) {
    if (index < friendsList.size()) {
    	if(!fromOnline)
    		return friendsList.get(index);
    	else{
    		int iterator = -1;
    		for(Friend friend: friendsList){
    			if(friend.isOnline())
    				iterator ++;
    			if(iterator == index)
    				return friend;
    		}
    	}
    }
    return null;
  }