private boolean shouldBeSwapped(int index1, int index2){
		if (index1>=size() || index1<0 || index2>=size() ||
				index2<0)
			return false;
		E object1 = theHeap.get(index1);
		E object2 = theHeap.get(index2);
		//Causes issues if one of them is null
		if (object1 == null || object2 == null)
			return false;
		//This line is key, because it takes into account whether or not
		//this heap is a Min-Heap or Max-Heap using the Ternary operator.
		return 0<object1.compareTo(object2)*(isMax ? 1:-1);
	}