package src;

import java.util.ArrayList;

public class Queue<T> {
	
	private int size = 0;
	private T element;
	private ArrayList<T> elements = new ArrayList<T>();

	public int size() {
		return size;
	}

	public void enqueue(T element) {
		size++;
		this.element = element;
		elements.add(element);
	}

	public T dequeue() {
		if (size == 0)
			throw new EmptyQueueException();
		size--;
		
		return elements.remove(0);
	}

	public boolean isEmpty() {
		return size == 0;
	}
}
@@ -66,51 +66,8 @@
 %7B%0A%09%0A
-%09private int size = 0;%0A%09private T element;%0A
 %09pri
@@ -114,16 +114,67 @@
 st%3CT%3E();
+%0A%09private static final int FIRST_ITEM_IN_QUEUE = 0;
 %0A%0A%09publi
@@ -197,20 +197,31 @@
 %09return 
+elements.
 size
+()
 ;%0A%09%7D%0A%0A%09p
@@ -256,44 +256,8 @@
 ) %7B%0A
-%09%09size++;%0A%09%09this.element = element;%0A
 %09%09el
@@ -309,25 +309,34 @@
 %7B%0A%09%09if (
-size == 0
+elements.isEmpty()
 )%0A%09%09%09thr
@@ -369,18 +369,8 @@
 ();%0A
-%09%09size--;%0A
 %09%09%0A%09
@@ -393,17 +393,35 @@
 .remove(
-0
+FIRST_ITEM_IN_QUEUE
 );%0A%09%7D%0A%0A%09
@@ -460,17 +460,26 @@
 urn 
-size == 0
+elements.isEmpty()
 ;%0A%09%7D

#11 - Refactored. FINAL