how to delete the last element of a collection without iterating it?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shiniskumar
    New Member
    • Feb 2007
    • 58

    how to delete the last element of a collection without iterating it?

    how to delete the last element of a collection without iterating it?
  • r035198x
    MVP
    • Sep 2006
    • 13225

    #2
    Originally posted by shiniskumar
    how to delete the last element of a collection without iterating it?
    If you know the object you can use remove(Object o) and pass the object to remove, otherwise, from the docs you can change the Iterator to an array first with the toArray method and remove the last object in the array.

    Comment

    Working...