Code example for LinkedList

Methods: peek, poll

0
		else if(a instanceof Cat)
			cats.add((Cat)a);
	} 
	 
	public Animal dequeue() { 
		if(dogs.peek().isOlderThan(cats.peek()))
			return dogs.poll();
		else return cats.poll();
	} 
	 
	public Animal dequeueCat() { 
		return cats.poll();
	} 
	 
	public Animal dequeueDog() { 
		return dogs.poll();
	} 
} 
 
class Animal { 
	String name;