Code example for LinkedList

Methods: add, poll, size

0
package main.java.com.webkonsept.minecraft.lagmeter; 
 
import java.util.LinkedList; 
 
public class LagMeterStack{ 
	private int						maxSize	= 0;
	private final LinkedList<Float>	stack	= new LinkedList<Float>();
 
	public void add(final Float item){
		if((item != null) && (item <= 20) && (item >= 0)){
			this.stack.add(item);
			if(this.stack.size() > this.maxSize){
				this.stack.poll();
			} 
		} 
	} 
 
	public void clear(final int i){
		this.stack.clear();
	} 
 
	public float getAverage(){ 
		float total = 0f;
		if(this.stack.size() == 0){
			return -1F; 
		}