Code example for TreeSet

Methods: addfirstremovesize

0
		log = new TreeSet<ProvenanceLogEntry>();
		this.maxSize = maxSize;
	} 
 
	public void addEntry(ProvenanceLogEntry entry) {
		log.add(entry);
 
		/* 
		 * if (log.size() > 1 && entry.getTimeStep() <= log.get(log.size() - 
		 * 2).getTimeStep()) { Collections.sort(log, 
		 * ProvenanceLogEntry.TIME_ORIGIN_COMPARATOR); } 
		 */ 
		if (log.size() > maxSize) {
			log.remove(log.first());
		} 
	} 
 
	public ProvenanceLogEntry getLatest() { 
		return log.last();
	}