com.vodafone360.people.engine.content
Class FiFoQueue

java.lang.Object
  extended by com.vodafone360.people.engine.content.FiFoQueue
All Implemented Interfaces:
java.lang.Iterable<ContentObject>, java.util.Collection<ContentObject>, java.util.Queue<ContentObject>

public class FiFoQueue
extends java.lang.Object
implements java.util.Queue<ContentObject>

Simple first in first out queue. Basically same as a LinkedList only without allowing null objects.


Field Summary
private  java.util.LinkedList<ContentObject> list
          LinkedList to perform all the operations.
 
Constructor Summary
FiFoQueue()
           
 
Method Summary
 boolean add(ContentObject content)
          Calls LinkedList.add(Object) if content is not null.
 boolean addAll(java.util.Collection<? extends ContentObject> contentCollection)
          Iterates over a collection and tries putting all objects into the list.
 void clear()
           
 boolean contains(java.lang.Object content)
           
 boolean containsAll(java.util.Collection<?> contentCollection)
           
 ContentObject element()
           
 boolean isEmpty()
           
 java.util.Iterator<ContentObject> iterator()
           
 boolean offer(ContentObject content)
          Calls LinkedList.offer(Object) if content is not null.
 ContentObject peek()
           
 ContentObject poll()
           
 ContentObject remove()
           
 boolean remove(java.lang.Object content)
           
 boolean removeAll(java.util.Collection<?> contentCollection)
           
 boolean retainAll(java.util.Collection<?> contentCollection)
           
 int size()
           
 java.lang.Object[] toArray()
           
<T> T[]
toArray(T[] type)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.util.Collection
equals, hashCode
 

Field Detail

list

private java.util.LinkedList<ContentObject> list
LinkedList to perform all the operations. Most methods in this class just call methods on this list.

Constructor Detail

FiFoQueue

public FiFoQueue()
Method Detail

element

public final ContentObject element()
Specified by:
element in interface java.util.Queue<ContentObject>
See Also:
LinkedList.element()

offer

public final boolean offer(ContentObject content)
Calls LinkedList.offer(Object) if content is not null.

Specified by:
offer in interface java.util.Queue<ContentObject>
Parameters:
content - ContentObject to put into the list

peek

public final ContentObject peek()
Specified by:
peek in interface java.util.Queue<ContentObject>
See Also:
LinkedList.peek()

poll

public final ContentObject poll()
Specified by:
poll in interface java.util.Queue<ContentObject>
See Also:
LinkedList.poll()

remove

public final ContentObject remove()
Specified by:
remove in interface java.util.Queue<ContentObject>
See Also:
LinkedList.remove()

add

public final boolean add(ContentObject content)
Calls LinkedList.add(Object) if content is not null.

Specified by:
add in interface java.util.Collection<ContentObject>
Specified by:
add in interface java.util.Queue<ContentObject>
Parameters:
content - The ContentObject to put into the list
Returns:
true if content was not null and the insertion was successful, false otherwise

addAll

public final boolean addAll(java.util.Collection<? extends ContentObject> contentCollection)
Iterates over a collection and tries putting all objects into the list. If one of the object is null the method will exit with false.

Specified by:
addAll in interface java.util.Collection<ContentObject>
Parameters:
contentCollection - to be added into the list
Returns:
true if every object of the provided collection could be put into the list, false otherwise

clear

public final void clear()
Specified by:
clear in interface java.util.Collection<ContentObject>
See Also:
LinkedList.clear()

contains

public final boolean contains(java.lang.Object content)
Specified by:
contains in interface java.util.Collection<ContentObject>
See Also:
LinkedList.contains(Object)

containsAll

public final boolean containsAll(java.util.Collection<?> contentCollection)
Specified by:
containsAll in interface java.util.Collection<ContentObject>
See Also:
LinkedList.containsAll(Collection)

isEmpty

public final boolean isEmpty()
Specified by:
isEmpty in interface java.util.Collection<ContentObject>
See Also:
LinkedList.isEmpty();

iterator

public final java.util.Iterator<ContentObject> iterator()
Specified by:
iterator in interface java.lang.Iterable<ContentObject>
Specified by:
iterator in interface java.util.Collection<ContentObject>
See Also:
LinkedList.iterator()

remove

public final boolean remove(java.lang.Object content)
Specified by:
remove in interface java.util.Collection<ContentObject>
See Also:
LinkedList.remove(Object)

removeAll

public final boolean removeAll(java.util.Collection<?> contentCollection)
Specified by:
removeAll in interface java.util.Collection<ContentObject>
See Also:
LinkedList.removeAll(Collection)

retainAll

public final boolean retainAll(java.util.Collection<?> contentCollection)
Specified by:
retainAll in interface java.util.Collection<ContentObject>
See Also:
LinkedList.retainAll(Collection)

size

public final int size()
Specified by:
size in interface java.util.Collection<ContentObject>
See Also:
LinkedList.size();

toArray

public final java.lang.Object[] toArray()
Specified by:
toArray in interface java.util.Collection<ContentObject>
See Also:
LinekdList.toArray();

toArray

public final <T> T[] toArray(T[] type)
Specified by:
toArray in interface java.util.Collection<ContentObject>
See Also:
LinkedList.toArray(T[] type);


JavaDoc