Code example for LinkedList

Methods: peekpoll

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 { 
Stop searching for code, let great code find you!  Add Codota to your java IDE