package com.glezo.queueSet;

import java.util.ArrayList;

public class QueueSet<T>
{
	private ArrayList<T>	queue;
	
	//-----------------------------------------------------------------------------------------------------------
	public QueueSet()							{	this.queue=new ArrayList<T>();								}
	//GETTERS----------------------------------------------------------------------------------------------------
	public boolean		contains(Object o)		{	return this.queue.contains(o);								}
	public boolean		isEmpty()				{	return this.queue.isEmpty();								}
	public void			add(T t)				{	if(!this.queue.contains(t)){this.queue.add(t);}				}
	public void			addIgnore(T t)			{	this.queue.add(t);											}
	public int			size()					{	return this.queue.size();									}
	public String		toString()				{	return this.queue.toString();								}
	public ArrayList<T>	get_whole_queue()		{	return this.queue;											}	
	public T peek()							
	{	
		if(this.isEmpty())
		{
			return null;
		}
		return this.queue.get(0);	
	}
	public T poll()							
	{	
		if(this.isEmpty())
		{
			return null;
		}
		T t=this.queue.get(0);	
		this.queue.remove(0);	
		return t;	
	}
}

@@ -49,16 +49,42 @@
 rayList;
+%0Aimport java.util.HashSet;
 %0A%0Apublic
@@ -125,16 +125,17 @@
 yList%3CT%3E
+%09
 %09queue;%0A
@@ -139,28 +139,45 @@
 e;%0A%09
-%0A%09//----------------
+private HashSet%3CT%3E%09%09%09hash_set;%0A%0A%09%0A%09//
 ----
@@ -289,17 +289,22 @@
 )%09%09%09%09%09%09%09
-%7B
+%0A%09%7B%09%0A%09
 %09this.qu
@@ -306,16 +306,18 @@
 is.queue
+%09%09
 =new Arr
@@ -332,41 +332,57 @@
 %3E();
+%0A
 %09%09
-%09%09%09%09%09%09%7D%0A%09//GETTERS-------------
+this.hash_set%09=new HashSet%3CT%3E();%0A%09%7D%0A%09//GETTERS
 ----
@@ -453,35 +453,32 @@
 ----------------
----
 %0A%09public boolean
@@ -492,20 +492,20 @@
 ins(
-Object o)%09%09%7B
+T o)%09%09%0A%09%7B%09%0A%09
 %09ret
@@ -509,29 +509,32 @@
 return this.
-queue
+hash_set
 .contains(o)
@@ -546,137 +546,224 @@
 %09%09%09%09
+%0A%09
 %7D%0A%09
-public boolean%09%09isEmpty()%09%09%09%09%7B%09return this.queue.isEmpty();%09%09%09%09%09%09%09%09%7D%0A%09public void%09%09%09add(T t)%09%09%09%09%7B%09if(!this.queue.contains(t))%7B
+//-------------------------------------------------------------------------------------------%0A%09public boolean%09%09add(T t)%09%09%09%09%0A%09%7B%09%0A%09%09if(this.hash_set.contains(t))%0A%09%09%7B%0A%09%09%09return false;%0A%09%09%7D%0A%09%09this.hash_set.add(t);%0A%09%09
 this
@@ -780,74 +780,186 @@
 (t);
-%7D
+%0A%09%09return true;
 %09%09%09%09
+%0A%09
 %7D%0A%09
-public void%09%09%09addIgnore(T t)%09%09%09%7B%09this.queue.add(t);%09%09%09%09%09%09%09
+//-------------------------------------------------------------------------------------------%0A%09public boolean%09%09isEmpty()%09%09%09%09%7B%09return this.queue.isEmpty();
 %09%09%09%09
@@ -1012,20 +1012,16 @@
 .size();
-%09%09%09%09
 %09%09%09%09%09%7D%0A%09
@@ -1084,20 +1084,16 @@
 g();%09%09%09%09
-%09%09%09
-%09
 %7D%0A%09publi
@@ -1157,14 +1157,105 @@
 %09%09%09%09
-%09%09%09%09%7D%09
+%7D%09%0A%09//-------------------------------------------------------------------------------------------
 %0A%09pu
@@ -1351,21 +1351,116 @@
 .get(0);
-%09
 %0A%09%7D%0A
+%09//--------------------------------------------------------------------------------------------%0A
 %09public 
@@ -1577,24 +1577,145 @@
 (0);
-%09%0A%09%09return t;%09%0A%09%7D
+%0A%09%09this.hash_set.remove(t);%0A%09%09return t;%09%0A%09%7D%0A%09//-------------------------------------------------------------------------------------------
 %0A%7D%0A

Update QueueSet.java