MCPcopy Create free account
hub / github.com/careercup/ctci / enqueue

Method enqueue

java/Chapter 3/Question3_7/AnimalQueue.java:10–18  ·  view source on GitHub ↗
(Animal a)

Source from the content-addressed store, hash-verified

8 private int order = 0;
9
10 public void enqueue(Animal a) {
11 a.setOrder(order);
12 order++;
13 if (a instanceof Dog) {
14 dogs.addLast((Dog) a);
15 } else if (a instanceof Cat) {
16 cats.addLast((Cat)a);
17 }
18 }
19
20 public Animal dequeueAny() {
21 if (dogs.size() == 0) {

Callers 1

mainMethod · 0.95

Calls 1

setOrderMethod · 0.80

Tested by

no test coverage detected