Gets the last menu entry or sub-menu, ignoring status and separators
()
| 257 | * Gets the last menu entry or sub-menu, ignoring status and separators |
| 258 | */ |
| 259 | public |
| 260 | Entry getLast() { |
| 261 | synchronized (menuEntries) { |
| 262 | // access on this object must be synchronized for object visibility |
| 263 | if (!menuEntries.isEmpty()) { |
| 264 | Entry entry; |
| 265 | for (int i = menuEntries.size() - 1; i >= 0; i--) { |
| 266 | entry = menuEntries.get(i); |
| 267 | |
| 268 | if (!(entry instanceof Separator || entry instanceof Status)) { |
| 269 | return entry; |
| 270 | } |
| 271 | } |
| 272 | } |
| 273 | } |
| 274 | |
| 275 | return null; |
| 276 | } |
| 277 | |
| 278 | /** |
| 279 | * Gets the menu entry or sub-menu for a specified index (zero-index), ignoring status and separators |