All pastes #966561 Raw Edit

Miscellany

public text v1 · immutable
·published 2008-04-01 20:47 UTC
rendered paste body
	
	public boolean insert(DataObject dao) {
		
		if (treeObjects.size() == 0) {
			return insert(dao, null);
		} else {
			return insert(dao, treeObjects.get(0));
		}
		
	}
	
	public boolean insert(DataObject dao, DataObject whereToStart) {
		if (whereToStart == null) {
			treeObjects.add(dao);
			return true;
		}
			
		if (dao.getKey() < whereToStart.getKey()) {
			return insert(dao, whereToStart.getLeftChild());
		} else {
			return insert(dao, whereToStart.getRightChild());
		}
	}