@Override
	public void addElement(K p) {
		if (size() == capacity()) ensureCapacity(size());
		if (isEmpty()) super.addElement(p);
		else {
			Object p1 = elementAt(0);
			Object p2 = elementAt(size() - 1);
			if (p.toString().compareTo(p1.toString()) <= 0) {
				insertElementAt(p, 0);
			} else if (p.toString().compareTo(p2.toString()) >= 0) {
				insertElementAt(p, size());
			} else {
				insert(p, 0, size() - 1);
			}
		}
	}