Performs a memory reference check to see it the obj exists in the stack. @param obj the object to search for in the stack @return true if this object is already in the stack otherwise false
(ObjectTypePair obj)
| 73 | * @return true if this object is already in the stack otherwise false |
| 74 | */ |
| 75 | public boolean contains(ObjectTypePair obj) { |
| 76 | if (obj == null) { |
| 77 | return false; |
| 78 | } |
| 79 | |
| 80 | for (ObjectTypePair stackObject : stack) { |
| 81 | if (stackObject.getObject() == obj.getObject() |
| 82 | && stackObject.type.equals(obj.type) ) { |
| 83 | return true; |
| 84 | } |
| 85 | } |
| 86 | return false; |
| 87 | } |
| 88 | } |