Discussion :: Objects and Collections - Finding the output (Q.No.7)
|Amala Rangnekar said: (Jul 17, 2014)|
|If 'it is it is also possible to get an Iterator over a Vector by invoking the iterator or listIterator method', then why are the values false?|
|Navya said: (Aug 6, 2014)|
|Ya someone please explain why its false ?|
|Anadikrishna said: (Sep 8, 2014)|
|Because ArrayList Does not implement the Enumerator interface. But Vector implements the Enumerator interface.
Vector doesn't support Iterator and List iterator Interface. So Vector Obj is not an instance of these two.
|Awdhesh said: (Jul 31, 2015)|
|Any one can write code for true true true for above problem?|
|Rohit said: (Jun 6, 2016)|
|@Anadikrishna. You are wrong.
Object x = new Vector().elements(); // for enumeration. (i.e) elements method is there to invoke enumeration so o/p is true,false,false.
If it was Object x = new Vector().iterator(); //now it's for Iterator i.e through iterator() method to invoke Iterator so o/p would be in this case : false , true, true.
Ssimilarly for ListIterator it should be like:
Object x = new Vector().listIterator() and o/p would be : false ,false ,true.
|Raj said: (Oct 27, 2018)|
|When we use this -> Object x = new Vector().listIterator().
The output will be -> false,true,true.
Am I right?
Post your comments here:
Email : (optional)
» Your comments will be displayed only after manual approval.