1175 |
|
} |
1176 |
|
|
1177 |
|
/** |
1178 |
+ |
* Returns {@code true} if this queue contains the specified element. |
1179 |
+ |
* More formally, returns {@code true} if and only if this queue contains |
1180 |
+ |
* at least one element {@code e} such that {@code o.equals(e)}. |
1181 |
+ |
* |
1182 |
+ |
* @param o object to be checked for containment in this queue |
1183 |
+ |
* @return {@code true} if this queue contains the specified element |
1184 |
+ |
*/ |
1185 |
+ |
public boolean contains(Object o) { |
1186 |
+ |
if (o == null) return false; |
1187 |
+ |
for (Node p = head; p != null; p = succ(p)) { |
1188 |
+ |
Object item = p.item; |
1189 |
+ |
if (p.isData) { |
1190 |
+ |
if (item != null && item != p && o.equals(item)) |
1191 |
+ |
return true; |
1192 |
+ |
} |
1193 |
+ |
else if (item == null) |
1194 |
+ |
break; |
1195 |
+ |
} |
1196 |
+ |
return false; |
1197 |
+ |
} |
1198 |
+ |
|
1199 |
+ |
/** |
1200 |
|
* Always returns {@code Integer.MAX_VALUE} because a |
1201 |
|
* {@code LinkedTransferQueue} is not capacity constrained. |
1202 |
|
* |